Docsity

Operating System Threads, Exercises of Computer science

Toggle sidebar
bg1
Operating System

Partial preview of the text

Download Operating System Threads and more Exercises Computer science in PDF only on Docsity!

Operating System

Objectives Accessing files using C programming language Creating more than 2 threads to access the same file Handling race conditions Text manipulation Operating System Assignment Introduction Develop a program to calculate the average of some values obtained from a file using multiple threads (Each row contains 3 values in the range of 10 to 99 separated by a comma) and write them to another file (output.txt). Deliverables A Program capable of doing following tasks ° ° Read line by line from the file (dataset.txt) Once a record of the file is read by a thread, the same record should not be taken by another thread. Calculate the average of each line and write it to another file (average.txt) Use printf statements wherever necessary to make it more user friendly All possible errors should be notified by printf statements State any assumptions you made as comments in the source code itself