

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
I am student at Baddi University of Emerging Sciences and Technologies. To help my friends in other universities, I am uploading my assignments of different courses. Its for Advanced Operating Systems course. Other can see if they are searching following: Execute, Command, Pipes, Functionality, Sort, Implement, Unix, Shell, Threading, Library
Typology: Exercises
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Question No. 1 [10 points] Explore and find the purpose of the following routines: Dup() Dup2()
(a) What is main difference between them?
In UNIX, on the command line, we often use pipes to connect programs so that the standard output of one program becomes the standard input of the next, For example, the command:
(b) Can dup and dup2 be used to make such sort of functionality? If yes, how? If no, give reason(s) why?
Question No. 2 [20 points] You are required to implement a Unix shell that supports the following commands: rm mv mkdir rmdir
Please note that you have to provide your own implementation, you are not allowed to use C function that takes an argument of a Unix command and executes that command.
Question No. 3 [30 points] Write a C program that creates two threads using the POSIX threading library. In the main program, create a file ‘data.txt’. First thread writes some numeric value to the file along with the system time, the second thread reads the data from the ‘data.txt’ file and displays the following information on standard output, i.e., computer screen.
Numeric Value Time when Value was written to the File Time when Value was Read by the Thread
You are required to use synchronization primitives provided by the UNIX OS to ensure consistency and serial access to the file, i.e., a thread can only read data from the file, if the other thread has written new data to the file, and a file is only accessed by a thread if the other thread is not using the file. The thread responsible for writing data to the file writes to the file after 500 ms. The program terminates when Ctrl+C is hit by the user.
Question No. 4 [20 points]
a. What are the motivations to the design development of Mach Kernel foundation development? b. Differentiate between the Task and Thread in Mach design.
c. What are the basic abstractions that the Mach kernel supports?
Question No. 5 [20 Points]