Week 3-4-5 Flashcards

1
Q

What are monitors

A

• Allow for a process to have mutual exclusion (prevents simulation access to a shared resource) and the ability to wait for processes to complete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In Java, synchronization is done in two ways. Synchronized ________ and _________

A

(blocks and methods).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the goal of scheduling?

A
  • To give max CPU utilization

* The longer the burst of CPU, the less likely it might happen

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When is a process allocated and what is it performed by?

A
-Performed by the scheduler
   •   Process goes to a wait state
   •   Process is interrupted
   •   Process goes from wait to ready
   •   Process terminates
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the scheduling criteria?

A
  • CPU usage
    • Throughput (jobs completed)
    • Turnaround time (time to complete)
    • Waiting time (time was waiting)
    • Response time (time to start once called)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the types of scheduling?

A

• First come first served
◦ Jobs are executed on first come, first serve basis.
•It is a non-preemptive, pre-emptive scheduling algorithm.
•Easy to understand and implement.
•Its implementation is based on FIFO queue.
•Poor in performance as average wait time is high.
• Shortest job first
◦ This is a non-preemptive, pre-emptive scheduling algorithm.
•Best approach to minimize waiting time.
•Easy to implement in Batch systems where required CPU time is known in advance.
•Impossible to implement in interactive systems where required CPU time is not known.
•The processer should know in advance how much time process will take.
• Round robin
◦ Round Robin is the preemptive process scheduling algorithm.
•Each process is provided a fix time to execute, it is called a quantum.
•Once a process is executed for a given time period, it is preempted and other process executes for a given time period.
•Context switching is used to save states of preempted processes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Jobs get assigned to the CPU with the _______ priority

A

highest)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Can an interrupt occur during a critical section?

A

• An interrupt can happen at any time, so the answer is Yes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Three Criteria for Critical Section

A
  • Mutual Exclusion - there can be only one process in the critical section
    • Progress - if the critical section is empty, and one or more processes are waiting, one gets to go in
    • Bounded Wait - if a process is waiting, the other process can only execute the critical section a limited number of times.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

User and Kernel Mode are distinguished by what?

A
  • The modes are distinguished by a bit in one of the registers of the CPU.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is deadlock and what do we do to prevent it?

A
  • When a process is holding something that another process requires
    • Prevention - ensure one of the 4 conditions never happens
  • Avoidance: extra information before allocating an available resource
  • Recovery: enter deadlock state and recover
  • Ignore hope it never happens, handle it manually
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are the four conditions that are needed for a deadlock

A
  • Mutex, only a limited number of things can use a certain resource
    • Hold and wait - a process has a resource and is waiting for another
    • No preemptive - Can’t take a resource that is in use
    • Circular wait - Processes are waiting on each other to do things
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a safe state?

A

• When there is no possibility of a deadlock happening

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do we terminate a deadlock?

A

• Terminate the process! Based on priority, compute time and how much resources it is taking up

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When do deadlocks occur in a resource allocation graph?

A

• When there is a circular dependancy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is happening here: (Process)->[resource]

A

The process (0) is requesting a resource ([])

17
Q

What is happening here: (Process)

A

resource ([]) is allocated to process

18
Q

Can only one resource by allocated to a process? (T/F)

A

True!

19
Q

How do you get the available in bankers algorithm?

A

Resource type - Allocation = Available

20
Q

How do you get the need in bankers algorithm?

A

Allocation - Max = Need

21
Q

If the need resources is less than the available the process _________ be executed

A

Can

22
Q

Work is work + ______

A

allocation,

23
Q

When binding a program to the OS, what are the 3 different stages:

A
  • Complile time
    • Load time
    • Execution time
24
Q

What is a linker?

A

• A computer program that takes object files and combines them to a single executable file

25
Q

What are the 3 parts of a program (think object file) and what do they do?

A
  • Header (array of structures (ex, function headings), allows a program to start execution)
    • Data Segment (tag for assembler that the upcoming section is data)
    • Text Segment (tag for assembler that the section is assembly language)
26
Q

What is logical vs physical address space?

A
  • Logical addresses are made by the CPU, visual

* Physical addresses are locations is physical memory

27
Q

What is logical vs physical address space?

A
  • Logical addresses are made by the CPU, visual

* Physical addresses are locations is physical memory

28
Q

What does the MMU do?

A

• The MMU maps virtual to physical addresses