Operating Systems Questions

Section I - Problems

 

1. Define the essential properties of the following types of operating systems:

a. Batch

b. Interactive

c. Time - Sharing

d. Real time

hard real time

soft real time

e. Distributed

loosely coupled system

tightly coupled system

 

2. Protecting the operating system is crucial to ensuring that the computer system operates correctly.

Provision of this protection is the reason behind dual-mode operation, memory protection, and the timer.

To allow maximum flexibility, however, we would also like to place minimal constraints on the user. The following is a list of operations that are normally protected. What is the minimal set of instructions that must be protected.

  1. Change to user mode
  2. Change to monitor mode
  3. Read from monitor memory
  4. Write into monitor memory
  5. Fetch an instruction from monitor memory
  6. Turn on timer interrupt
  7. Turn off timer interrupt

 

3. When are caches useful? What problems do they solve? What problems do they cause? If a cache can be made as large as the device it is caching for (for instance, a cache as large as a disk) why not do so and eliminate the device?

 

4. Writing an operating system that can operate without interference from malicious or undebugged user programs requires some hardware assistance. Name three hardware aids for writing an operating system, and describe how they may be used together to protect the operating system.

 

5. What are the five major activities of an operating system in regard to process management/

 

6. What are the three major activities of an operating system in regard to memory management?

 

7. What are the three major activities of an operating system in regard to memory management?

 

8. what are the three major activities of an operating system in regard to secondary-storage management?

 

9. What are the five major activities of an operating system in regard to file management?

 

10. What is the main advantage for an operating system designer of using a virtual - machine architecture? What is the main advantage for a user?

 

11. The correct producer-consumer algorithm presented in Section 4.4 allows only n-1 buffers to be full at any time. Modify the algorithm to allow all the buffers to be utilized fully.

 

12. A CPU scheduling algorithm determines an order for the execution of its scheduled processes. Given n processes to be scheduled on one processor, how many different schedules are there?

Give a formula in terms of n.

 

13. Consider the following set of processes, with the length of the CPU-burst time given in milliseconds:

Process Burst Time Priority

P1 10 3

P2 1 7

P3 2 2

P4 1 5

P5 5 2

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5,all at time 0.

  1. Draw four Gantt charts illustrating the execution of these processes using FCSS, SFJ, a nonpreemptive
  2. priority (a smaller priority number implies a higher priority) and RR (quantum=1) scheduling.

  3. What is the turnaround time of each process for each of the scheduling algorithms in part a?
  4. What is the waiting time of each process for each of the scheduling algorithms in part a?
  5. Which of the schedules in part a. results in the minimal average waiting time (over all processes)?

14. Suppose that the following processes arrive for execution at the times indicated. Each process will run the listed amount of time. In answering the questions, use nonpreemptive scheduling and base all decision the information you have at the time the decision must be made.

Process Arrival time Burst Time

P1 0.0 8

P2 0.4 4

P3 1.0 1

  1. What is the average turnaround time for these processes with the FCFS scheduling algorithm?
  2. What is the average turnaround time for these processes with the SJF scheduling algorithm?
  3. The SFJ algorithm is supposed to improve performance, but notice that we chose to run the process P1 at time 0 because we did not know that two shorter processes would arrive soon. Compute what the average turnaround time will be if the CPU is left idle for the first 1 unit and then SFJ scheduling is used. Remember that processes P1 and P2 are waiting during this idle time, so their waiting time may increase. This algorithm could be known as future-knowledge scheduling.

 

15. Consider a variant of the RR scheduling algorithm where the entries in the ready queue are pointers to the PCBs.

  1. What would be the effect of putting two pointers to the same process in the ready queue?
  2. What would be the major advantages and disadvantages of this scheme?
  3. How would you modify the basic RR algorithm to achieve the same effect without the duplicate pointers?

 

16. Consider the following preemptive priority-scheduling algorithm based on dynamically changing priorities. Larger priority numbers imply higher priority. When a process is waiting for the CPU (in the ready queue, but not running), its priority changes at a rate a ; when it is running, its priority changes at a rate b . All processes are given a priority of 0 when they enter in the ready queue. The parameters a and b can be set to give many different scheduling algorithms.

  1. What is the algorithm that results from b > a > 0 ?
  2. What is the algorithm that results from a < b < 0 ?

 

17. Many CPU scheduling algorithms are parameterized. For example, the RR algorithm requires a parameter to indicate the time slice. Multilevel feedback queues require parameters to define the number of queues, the scheduling algorithm for each queue, the criteria used to move processes between queues, and so on.

These algorithms are thus really sets of algorithms (for example, the set of RR algorithms for all time slices, and so on). One set of algorithms may include another (for example, the FCFS algorithm is the RR algorithm with an infinite time quantum). What (if any) relation holds between the following pairs of sets of algorithms?

  1. Priority and SJF
  2. Multilevel feedback queues and FCFS
  3. Priority and FCFS
  4. RR and SJF

 

18. Suppose that a scheduling algorithm (at a level of short-term CPU scheduling) favors those processes that have used the least processor time in the recent past. Why will this algorithm favor I/O-bound programs and yet not permanently starve CPU-bound programs?

19. Show that, if the wait and signal operations are not executed atomically, then mutual exclusion may be violated.

20. The Cigarette-Smokers Problem. Consider a system with three smoker processes and one agent process. Each smoker continuously rolls a cigarette and then smokes it. But to roll and smoke a cigarette, the smoker needs three ingredients: tobacco, paper, and matches. One of the smoker processes has paper, another has tobacco, and the third has matches. The agent has an infinite supply of all three materials. The agent places two of the three ingredients on the table. The smoker who has the remaining ingredient then makes and smokes a cigarette, signaling the agent on completion. The agent then puts out another two of the three ingredients and the cycle repeats. Write a program to synchronize the agent and the smokers.

 

  1. Write a solution for the bounded buffer problem using semaphores. The bounded buffer problem involves two processes: a producer and a consumer. The two processes use a finite size buffer to communicate with each other. The producer puts (writes) the items in the buffer; the consumer extracts (reads) them from the same buffer. Assume the buffer has a capacity of N items.
  2. Consider the following set of processes, with the length of the CPU burst time given in milliseconds:

Process

Burst Time

Priority

P1

10

3

P2

1

1

P3

2

3

P4

1

4

P5

5

2

The processes are assumed to have arrived in the order P1, P2, P3, P4, P5, all at time 0.

  1. Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a non-preemptive priority (a smaller priority number implies a higher priority), and RR (quantum =1) scheduling.
  2. What is the turnaround time of each process for each of the scheduling algorithms in part a?
  3. What is the waiting time of each process for each of the scheduling algorithm in part a?
  4. Which of the schedules in part a results in the minimal average waiting time (over all processes)?

 

Section II - Review questions

 

  1. Discuss various types of storage devices and their characteristics.
  2. Discuss protection mechanisms in a modern operating system.
  3. Discuss virtual machines. What are they? How are they implemented and used? What are the advantages and disadvantages of VM with respect to other solutions with address the same problem?
  4. Draw the process state diagram in an operating system with multiprogramming, primary and secondary storage and preemptive scheduling. Define each state and explain how processes travel from one state to another.
  5. Discuss process creation in a Unix-like operating systems. Discuss the system calls involved and draw a diagram representing the process creation. What are the advantages and disadvantages of such process creation mechanism with respect to other possible mechanisms.

 

Section III - Multiple choice/Binary

 

You should know the meaning of terms like:

Kernel, assembler, loader, linker, driver, spool, symmetric and asymmetric multiprocessing, interrrupt, trap, system call, device status table, mechanism, policy, process, scheduling, process control block, I/O and CPU bound process, context switch,

 

1) A multiuser operating system is an operating system that:

  1. can run several programs at the same time
  2. can accommodate in memory several active processes at the same time
  3. can be used by several users at the same time
  4. can be used by several users at different moments in time
  5. needs the presence of several users to function properly

 

2) multitasking operating system is an operating system that:

  1. is run on a machine which has several processors
  2. can accommodate in memory several active processes at the same time
  3. can be used by several users at the same time
  4. can be used by several users at different moments in time
  5. needs the presence of several users to function properly

 

3) A time sharing operating system is an operating system that:

  1. can accommodate in memory several active processes at the same time
  2. shares the CPU time between processes using equal time quanta
  3. shares the CPU time between processes using a priority based scheduling system
  4. shares the CPU time between processes using a batch algorithm
  5. shares the CPU time between processes using a random distribution

 

4) The portability of an operating system means that:

  1. the programs which run on the given operating system and some given hardware platform can be run easily on a different operating system on the same hardware platform
  2. the programs which run on the given operating system and some given hardware platform can be run easily on a different operating system on a different hardware platform
  3. the operating system itself can be run easily (after re-compilation) on a different hardware platform
  4. the given operating system can be carried without difficulty from one location to another
  5. the operating system can be used to carry the hardware from one location to another

 

5) A multiuser operating system has to be also:

  1. multitasking
  2. time-sharing
  3. portable
  4. multitasking and portable
  5. multitasking and time-sharing

 

6) A multitasking system has to be:

  1. time-sharing (in the sense of using equal quanta to distribute the CPU time among different processes)
  2. time-sharing (in the sense of using some mechanism for distributing the CPU time among different processes)
  3. portable
  4. run on a multi-processor hardware platform
  5. none of the above

 

7) When talking about an operating system, the "kernel" is:

  1. the part which deals with the user interface
  2. the central part, which offers the basic functionality of the operating system
  3. the part which deals with peripheral devices
  4. the central processing unit of the computer
  5. none of the above

 

8) What is the relationship between files and directories:

  1. a file can contain one or more directories and no files
  2. a file can contain one of more other files and no directories
  3. a directory can contain one or more directories and no files
  4. a directory can contain one or more files and directories
  5. a directory can contain one or more files and no directories

 

 

14) An operating system is:

  1. a collection of programs which allow the user(s) to utilize the hardware resources of the computer
  2. a hardware sub-system which groups together those hardware parts of the computer which are essential its functioning
  3. a collection of programs which can be used by programmers through calls from their programs
  4. a specific type of hardware
  5. a collection of programs which deal with the management of the processes which run on a computer

 

 

 

 

15) What are the similarities between a network of personal computers and a mini-computer using a multiuser operating system:

  1. both allow many users to use the same CPU
  2. both allow many users to share the same files if so desired
  3. 1 and 2 at the same time
  4. there are no similarities
  5. there are similarities but they are not mentioned above

 

16) What are the differences between a network of personal computers and a mini-computer using a multiuser operating system:

  1. in a network of personal computers each user runs their programs on the same CPU whereas in a mini-computer each program is run on a different CPU
  2. in a network of personal computers each user runs their programs on different CPU's whereas in a mini-computer each program is run on the same CPU
  3. a network of personal computers can accommodate more users than a minicomputer using a multiuser operating system
  4. a minicomputer using a multiuser operating system can accommodate more users that a network of personal computers
  5. none of the above