• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/25

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

25 Cards in this Set

  • Front
  • Back

When does the CPU interrupt a device?

CPU NEVER interrupts a device

When does a CPU acknowledge an interrupt?

After current instruction execution

When does a process switch from the waiting state to the running state?

Process NEVER switches from waiting to running

What are the reasons for a process to lose CPU in a non-preemptive scheduling system?

1. I/O loop
2. terminate process

Assume that there are ten processes total currently in a system with five CPUs. Four processes are running, four are in the ready state, and two are in the waiting state.

1. How many PC registers does the system have?


2. How many PC registers are being used by those ten processes?

1. 5 PC registers because there are 5 CPUs




2. 4 PC registers are being used (4 are running)

Consider a process that has spent 30 units of CPU time, 60 units in the ready state, and 100 units in the I/O waiting queue.




1. What is the turnaround time of the process?




2. What is the waiting time of the process?

1. turnaround time = CPU time + ready time = 90 units




2. waiting time = ready state = 60 units

What does the PC field in the PCB of a running process indicate?

the starting address of the CPU bursts

What does the PC field in the PCB of a waiting process indicate?

The next instruction to be executed

Consider the event of context switching from process Pi to Pj.




Which register will be saved in the PCB of Pi ?

PC and registers being used

Assume that typical process spends 90% of the time in I/O activity, and the system maintains 20 programs in memory on an average.




1. What is the CPU utilization?




2. What is the probability of the CPU being idle?

1. CPU utilization = (1 - Pⁿ) = (1-0.9²⁰)




2. Probability = Pⁿ = 0.9²⁰



Consider the following program:




CPU_statement;


Input_statement;


Output_statement;


CPU_statement;




How many CPU and I/O burst would be created by the above program?

CPU bursts = # I/O bursts + 1 = 2 + 1 = 3




I/O bursts = 2

Consider a system using time slices of 100 ms. Assume process Pi needs 20 seconds of CPU time.




How many times slices would Pi require to complete its task?

Pi needs at least 200 time slices because it can take more time

Consider a system with time slices of 200 ms. Assume that a process Pi has used a CPU bursts of length 4000ms. Assume that the system has many other processes sharing the CPU with Pi.




How many time slices did Pi use during that CPU bursts?

Exactly 20 time slices since you cannot use a time slice in CPU if I/O is not present

A CPU scheduler is invoked in many events. List all possible events when a preemptive schedule will be invoked, but a non-preemptive scheduler will not be.

- Time out


- submit state to ready state


- waiting state to ready state after I/O done

Consider an execution of a set of 20 processes running under the SJN schedule. COnsider another execution of the same set of processes running under the SRT schedule.




In what situation will the total turnaround time be the same for both SJN and SRT schedulers?

Processes arrive in non decreasing order of CPU time requirement

Consider a system running under a RR scheduler using a time slice of 100 time units. Assume that no process is running in the current state. There are 200 processes in the ready queue and 300 processes in the waiting queues.




How long will the last process in the ready queue wait before getting the CPU?

last process will be served in ≤ [(n-1)t == (100 * 199)]




≤ because some processes can use less time slices

Consider the Linux scheduler discussed in class. When does a process move from the active array to the expired array?

1. There are starving processes in the expired array so the process, even if it is highly interactive, cannot stay in the active




2. If the above is true and the time slice is up

Consider the load balancer in the Linux scheduler discussed in class.




1. Which processes have the highest priority to migrate?




2. When can a process be preempted?

1. Expired array and not cache hot process have highest priority




2. A process is preempted when its time slice is up or a process joins ready state and priority is higher than the running process

Consider the Linux scheduler discussed in class.


When does the kernel check the need_resched flag? Explain the reason.

It checks right before it switches from kernel mode to user mode




This is to decrease the amount of switching

Give an example of a privileged register.

Instruction registers

What are the two modes a system run in?

Privileged mode and user/non-privileged mode

What is a virtual CPU?

-time multiplexing, CPU switches multiple programs at high frequencies




-creates illusion of multiple dedicated CPU

What is the purpose of multi programming?

To increase CPU processes

When does a process switch from the running state to ready?

After time out

What are the reasons for a process to lose a CPU?

*State diagram*


running state to ready state


running state to I/O loop


running state to terminated