0% found this document useful (0 votes)
97 views2 pages

System Calls and Process Execution Analysis

Study materials

Uploaded by

john
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views2 pages

System Calls and Process Execution Analysis

Study materials

Uploaded by

john
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1. Four processes execute on a system with a single CPU and a single I/O device.

The system uses


multiprogramming without time-sharing. Each process has a compute-bound phase of 40
time-units followed by an I/O-bound phase of 20 units. A process cannot initiate the I/O phase
until the I/O device becomes free. (2 points)
The processes start executing in the order p1, p2, p3, p4.

During the execution of all processes,

the CPU is idle for time units ___20_.

the I/O device is idle for time units __100_.

2. Four processes execute on a system with a single CPU and a single I/O device. The system uses
multiprogramming without time-sharing. Each process has a compute-bound phase of 60
Time-units followed by an I/O-bound phase of 30 units. A process cannot initiate the I/O phase
until the I/O device becomes free. (2 points)

The processes start executing in the order p1, p2, p3, p4.

During the execution of all processes,

the CPU is idle for time units _30_

the I/O device is idle for time units _150_

3. Processes p1 and p2 execute on a system with a single CPU and 2 identical I/O devices. The
compute-bound phase of each process is 600 time-units, followed by an I/O-bound phase of 300
time-units. The processes run concurrently using time-sharing. Assume that the switching
overhead and the switching periods are negligible. (2 points)

If both I/O devices are used, then the total execution time for both processes is __1500_time
units.

If only one I/O device is used, then the total execution time for both processes is _1500_time
units.

4. Processes p1 and p2 execute on a system with a single CPU and 2 identical I/O devices. The
compute-bound phase of each process is 500 time-units, followed by an I/O-bound phase of 250
time-units. The processes run concurrently using time-sharing. Assume that the switching
overhead and the switching periods are negligible. (2 points)

If both I/O devices are used, then the total execution time for both processes is__1250_ time
units.

If only one I/O device is used, then the total execution time for both processes is__1250_ time
units.

5. List down any 15 system calls and explain its functionalities in one or two lines. (7 points)

1) fork(): Creates a new process by duplicating the calling process, with the child process being
an exact copy of the parent process except for the return value.
2) exec(): Replaces the current process image with a new process image specified by the path
or file parameter, allowing a program to run another program.
3) wait(): Suspends execution of the calling process until one of its child processes terminates
4) getpid(): Returns the process ID of the calling process, which is useful for logging and
process management
5) kill(): Sends a signal to a process or a group of processes, which can be used for inter-
process communication or process control.
6) sleep(): Suspends execution of the calling process for a specified number of seconds,
allowing other processes to run.
7) open(): Opens a file specified by pathname and returns a file descriptor used in subsequent
operations on that file.
8) read(): Reads data from an open file into a buffer, returning the number of bytes read.
9) write(): Writes data from a buffer to an open file, returning the number of bytes written.
10) mkdir(): Creates a new directory with the specified name and permissions.
11) rmdir(): Removes an empty directory, returning an error if the directory is not empty.
12) chmod(): Changes the permissions mode of a file, controlling who can read, write, or
execute it.
13) chown(): Changes the owner and group of a file, which affects access permissions.
14) time(): Returns the current time as the number of seconds since the Epoch, used for timing
and synchronization
15) mount(): Attaches the filesystem found on a device to the specified directory in the file
hierarchy

You might also like