Midterm Flashcards

(63 cards)

1
Q

What is the kernel

A

The core of the OS. The one program running at all times on the computer

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

Process

A

A program in execution; instance of a program being executed by OS

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

3 components of a process

A
  • (code)Executable program
  • (data) Associated data needed by the program
  • (context) The execution context of the process which contains all information the OS needs to manage the process (ID, state, CPU registers, stack)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is and where is PCB?

A

Process Control Block is included in the context, along with the stack
It is snapshot that contains all necessary and sufficient data to restart a process where it left off (ID, state, CPU registers)
- concrete representation of a process

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

Where in OS is PCB?

A

It is one entry in the OS’s process table (array of linked list)

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

What is in user address space of process?

A

Program code
Data

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

What is in context of process

A

PCB
Stack

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

What are 3 main components of PCB?

A

Identification
CPU State info (registers, PC, stack pointer)
Control info (Schedule and state info, links to other processes, memory limits, open files)

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

5 states of process and what they mean

A

New: process is being created
Ready: The process is waiting to be assigned to a processor
Running: Instructions are being executed
Waiting: The process is waiting for some event to occur
Terminated: The process has finished execution

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

New to ready process

A

admitted

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

Ready to running process

A

scheduler dispatch

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

Running to ready process

A

Interrupt

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

Running to waiting process

A

I/O or event wait

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

Waiting to Ready process

A

I/O or event completion

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

Running to terminated process

A

exit

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

What is batch system?

A

A computer system that processes jobs in groups, or batches, without direct user interaction

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

4 ways a process can be created

A

System boot
User requests to run application
Existing process spawns a child process
Batch system takes next job in line

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

3 ways process is terminated

A

Regular completion, with or without error code
Fatal error (uncatchable of uncaught)
Killed by another process via the kernel

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

Return value of fork to parent and child

A

positive value to parent
0 to child

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

what does execvp do

A

replace the existing program

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

Fork example 1

A

process 13

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

2 events that lead to process pause/dispatch

A
  • I/O Wait - OS triggered
  • Preemptive timeout - hardware interrupt triggered
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What 5 things happen when a current process calls create()

A
  • PCB is allocated and initialized
  • The parent field of the new process will be set to self (running process)
  • new process P is added to the children list of the currently running process
  • The new process P is put in ready list
  • The scheduler may choose to dispatch to new process or continue the parent
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

What is and happens during a process context switch

A

When cpu switches to another process, the system must save the state of the old process and load the saved state for the new process

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Is context switching useful work?
No
26
Is there a difference between a new process and the other processes? can you tell this is a new one?
if OS has a toll how long a process has been run for, but otherwise they are very similar
27
Process Context Switching 7 steps
- Save cpu context, including PC and registers - Update process state and other fields of PCB - Move the PCB to appropriate queue - Select another process for execution: made by CPU scheduling algorithm - Update the PCB of selected process (switch to running) - Update memory management structures - Restore CPU context to the values contained in the new PCB
28
What events trigger OS to switch processes? 3
Interrupts Exceptions System Calls
29
Interrupts event
External, asynchronous events, independent of the currently executing process instructions
30
Exceptions events
Traps, internal synchronous (but involuntary) events caused by instructions: OS may terminate or recover process
31
System Call events
Traps, voluntary synchronous events calling a specific OS service.
32
Job queue
Set of all jobs in the system
33
Ready Queue
Set of all processes residing in main memory, ready and waiting to execute
34
Device Queue
Set of processes waiting for I/O device
35
Long term scheduler
The decision to add a program to the pool of processes to be executed (job scheduling)
36
Medium term scheduling
The decision to add to the number of processes that are partially or fully in main memory (swapping)
37
Short term scheduling
CPU Scheduling, the decision as to which available processes in memory are to be executed by the processor (dispatching)
38
Draw scheduler pic
process 31
39
Long term scheduler controls
the degree of multiprogramming
40
Which scheduler is invoked more frequently?
Short term scheduler
41
io bound process vs cpu bound process
io bound spends more time doing io than computations, many short cpu bursts, and vice versa
42
examples of io bound and cpu bound
chat applications, interactions // photo editors, gaming
43
What does Long term scheduler have to do
Needs to make careful decisions, decides what comes and stays on system at current time, decides when process terminates
44
What happens if io scheduled first, what if cpu scheduled first?
- little cpu utilization, and u have many things to do, cpu not fully working - lost interactivity, io tasks waiting intensively for cpu tasks to finish, even though they only need a little cpu
45
swapping
memory management technique that temporarily swaps processes from main memory to secondary memory and vice versa, helps increase degree of multi-programming and increase main memory utilization
46
Mechanisms for processes to communicate and synchronize their actions
Shared memory Message passing
47
Shared memory
By using the same address space and shared variables
48
Message Passing
Processes communicate with each other without resorting to shared variables
49
Message passing - direct communication
Processes know who they are talking to. They must name each other explicitly
50
Message Passing - indirect communication
Processes dont know who they are talking to. Messages are directed and received from mailboxes
51
Message passing - blocking
Synchronous, The sender blocks until the message is received, the receiver blocks until the message is available. Ex:
52
Message Passing - Non-blocking
Asynchronous, sender send message and continues, receiver receives a valid message or null Ex: streaming service, drone sending signal
53
What to do with multiple messages
Use Buffer, queue of messages attached to the link, implemented in zero, bounded, or unbounded
54
Time sharing, each process is given a
Multiple processes running on one physical cpu. Virtual CPU
55
Virtual CPU
A cpu that the process assumes is available only to itself
56
Benefits of virtual cpu 3
Multi user support Multi CPU transparency Portability
57
Two ways to organize PCBs
Array of Structures -> wasted memory Array of pointers to dynamically allocated PCBs -> overhead of dynamic memory management
58
Waiting list
Contains all processes blocked on a resource
59
Ready List
Contains all processes that are in ready state and able to run on CPU
60
A resource is allocated to a process if
the process has access to and is able to utilize the resource
61
A resource is free if
the resource may be allocated to a requesting process
62
Scheduler function
Determines which process should run next and starts the process
63