Pages From Operating Systems Design 19CS2106S Home Assignment CO

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Operating Systems Design - 19CS2106S

Home Assignment - CO-II


Mode of submission: Post Hand written scanned documents in LMS
Submission date: on or before 18th October, 2020

1. List the Main information in the user structure (u area) and process table entry.
In which structure does UNIX v6 allocate the kernel stack? How many of these structures does v6
allocate?

2. Suppose a process goes to sleep and the system contains no process ready to run. What happens
when the sleeping process does its context switch? In xv6, explain the design of sleep, sys_sleep,
wakeup, wakeup1.

3. Explain the design of the algorithms: inthand, syscall.


Most round-robin schedulers use a fixed size quantum. Give an argument in favor of a small
quantum. Now give an argument in favor of a large quantum. Compare and contrast the types of
systems and jobs to which the arguments apply. Are there any for which both are reasonable? Which
type of process is generally favored by a multilevel feedback queuing scheduler - a processor bound
process or an I/O-bound process? Briefly explain.

4. (ii).Write a system program that accepts two small numbers (< 50) as arguments and then sums the
two in a child process. The sum should be returned by the child to the parent as its exit status, and the
parent should print the sum.

5. (i). Explain context switch in xv6 with respective to trap.c, trapasm.s, syscal.c, and swtch.s
6. (ii). Processes provide context. Explain what constitutes a process. List the tasks performed by the
fork system call.

7. In xv6, explain Scheduling Parameters and Controlling Process Priorities using Swtch(), yield(),
sched().

8. (i). Round-robin schedulers normally maintain a list of all runnable processes, with each process
occurring exactly once in the list. What would happen if a process occurred twice in the list? Can
you think of any reason?
(ii). I have just invented a new scheduling algorithm that I claim gives the highest priority to
processes that have just entered the system, but is fair to all processes. The algorithm works like this:
There are two queues, one for new processes and one for old processes. When a process enters the
system, it is put at the end of the new queue. After 2 milliseconds on the new queue, whether a
process has been scheduled or not, it is moved to the end of the old queue. When it is time to
schedule a process, the system schedules the process at the head of one of the queues, alternating
between the two queues. Each process runs to completion before the next process is scheduled.
Assume that processes enter the system at random times and that most processes take much longer
than 2 milliseconds to execute. Does this algorithm give the highest priority to new processes?
Explain your answer. Is this algorithm starvation free? Explain your answer. Discuss whether this
algorithm is fair to all processes. By “fair” we mean every process has a wait time approximately
equal to the average wait time, assuming all processes have close to the same execution time.

9. In xv6, why each process has 2 stacks? What are the conceptual stages through which a process
moves while being managed by the operating system? Describe how a process might move through
the various process states. Create specific reasons why this process moves from one state to another.
Explain Process & kernel data structures: struct proc, allproc function.

10. Illustrate UNIX system boot and processes creation.


Write the C-style illumination of the part of the shell program involving the use of the fork, waitpid,
and execve

You might also like