Assignment 1
Assignment 1
CSE-4A
CPU Scheduling
Deadline: - 13-02-2019
1. Given a system with n processes, how many possible ways those processes are scheduled?
2. Differentiate process and thread. Describe all the entries of process control block.
3. Describe the differences among short term, medium term & long term scheduling.
4. Describe the actions a kernel takes to context switch between processes.
5. Write the syntax and explain the use of following system calls:
Fork, exec, wait, exit
6. Why context switching time should be minimum? How it is dependent on hardware support?
7. What will happen when system call is encountered in a user program?
8. What is the main advantage of multiprogramming?
9. Differentiate the APIs and System calls role in OS with suitable example.
10. Write a program in ‘C’ (Linux OS) in which the child process sends the name of one of the
existing file on disk to the parent process and the parent process displays the contents of that file.
The communication between the parent and the child is through pipe
11. What is the significance of kernel and user mode in OS? Explain with suitable example
12. What are the advantages of Virtual Machine?
13. Write a program in ‘C’ (Linux OS) which displays numbers from 1 to 10 and alphabets from A to
E alternately ( 1 2 A 3 4 B …. ). The program should have two threads (pthreads), One of the
thread displays numbers and other one displays alphabets. (Hint : Use sleep())
14. What is the main advantage of microkernel approach to system design? How do user programs
and system services interact in microkernel architecture? What are the disadvantages of using
microkernel approach?
15. Write down the differences between
a. User Thread and Kernel Thread
b. Fork () function and clone () function
c. CPU burst and I/O burst
16. Explain operating system and importance?
17. Write a program in ‘C’ (Linux OS) in which a parent forks a child and child forks a grandchild. The
program should display the output as “My process ID is A, my parent’s ID is B and my grandfather’s
ID is C”, where A, B and C are the process ID’s.
18. Write a program in ‘C’ (Linux OS) in which the parent process sends the length and breadth of a rectangle
and child process computes the area of rectangle. The communication between the parent and the child is
through pipe.
19. Write down a short note on Process Explore tool for Windows.
20. What resources are used when a thread is created? How do they differ from those used when a
process is created?
21. Write down a program to create two child processes and print following sequence by them
Child 1: - 2 4 8 16 32 64
Child 2: - 2 5 8 11 14 17
22. For processes listed in table, draw a chart illustrating their execution using
(a) FCFS
(b) SJF and Preemptive SJF (Shortest Remaining time first)
(c) RR (TQ-2)
(d) RR(TQ-1)
Also calculate average turnaround time, average wait time and average waiting time for each
algorithm.
23. For the process listed in table below, draw a chart illustrating their execution using preemptive
Non preemptive priority scheduling. A larger priority number has higher priority.
24. Consider the following set of processes, with the length of the CPU-burst time given in
milliseconds:
The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.
a. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a
nonpreemptive priority (a smaller priority number implies a higher priority), and RR
(quantum = 1) scheduling.
b. What is the turnaround time of each process for each of the scheduling algorithms in part a?
c. What is the waiting time of each process for each of the scheduling algorithms in parta?
d. Which of the schedules in part a results in the minimal average waiting time (over all processes)?
25. Consider the following set of processes, with the length of the CPU-burst time given in
Milliseconds:
Arrival time Burst Time Priority Process Type
P1 0 7 1 System
P2 3 8 2 Interactive
P3 5 2 1 System
P4 9 12 5 System
P5 0 2 2 Interactive
P6 2 3 1 Others
Schedule the above process as per following algorithm and find the Average waiting and TAT time.
a. Multi-level queue
System Queue – P-SJF
Interactive – RR-2
Others –FCFS