Chp 2 Process/Threads Flashcards

(80 cards)

1
Q

How does the OS keep track of each process?

A

Process Control Block

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

Process

A

Program in execution
Instance of a program being executed by an OS

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

What is the concrete representation of a process?

A

PCB

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

Who creates the PCB for a process?

A

OS

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

Process Ready-> Running caused by

A

OS

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

Process Running -> blocked caused by

A

process

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

Process Running -> Ready caused by

A

OS

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

Process Blocked -> Ready caused by

A

Another process releasing the resources it was waiting for

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

How many processes is the cpu running at a time

A

1

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

Context switch

A

The transfer of control from one process to another

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

CPU state

A

Consists of all intermediate values held in any CPU registers and hardware flags at the time of interruption

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

3 parts of a process image

A

Executable program
Associated data needed by the program
Execution context

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

What is in execution context

A

ID, state, cpu registers, stack, etc.

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

What is PCB

A

A snapshot that contains all necessary and sufficient data to restart a process where it left off

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

Where (broad) is the PCB?

A

In the context

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

Where is the PCB?

A

One entry in the OSs process table (array or linked list)

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

What are two parts of process (broad)

A

User address space, context

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

What does user address space contain?

A

Program, dataW

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

What does context contain

A

Stack, PCB

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

4 ways a process can be created

A

System Boots
User requests to run an application
An existing process spawns a child process
A batch system takes on the next job in line

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

3 ways a process can be terminated

A

Regular completion
Fatal Error
Killed by another process via the kernel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
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
22
Q

When the CPU switches to another process (context switch) what two things must it do?

A

The system must save the state of the old process
The system must load the saved state for the new process

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

Does the system do useful work during context switching

A

no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
What events trigger the OS to switch processes?
Interrupts: External, Asynchronous Executions (traps): Internal, synchronous (but involuntary) System calls (traps): Voluntary synchronous events after calling a specific OS service
25
Long term scheduler
Decides to add a program to the pool of processes to be executed (job scheduling)
26
Medium term scheduler
The decision to add to the number of processes that are partially or fully in main memory (swapping)
27
Short term scheduling
CPU scheduling, decides as to which available processes in memory are to be executed by the processor
28
Which scheduler controls the degree of multiprogamming
Long term scheduler
29
I/O bound process
spends more time in I/O than computations, many short CPU bursts
30
CPU-bound process
Spends more time doing computations, few very long CPU bursts
31
Which scheduler removes processes from memory "temporarily" to reduce degree of multiprogramming?
Medium term scheduler
32
Cooperating processes
Can affect or be affected by the execution of another process
33
Two mechanisms for interprocess communication
Shared Memory Message Passing
34
What do P and Q need to establish if they want to communicate?
Communication Link
35
Direct Communication
Processes must name each other explicitly
36
Indirect Communication
Messages are directed and received from mailboxes (ports)
37
Solutions to multiple processes on a mailbox
Allow a link to be associated with at most two processes Allow only one process at a time to execute a "receive" operation Allow the system to select the receiver arbitrarily, sender is notified who the receiver was
38
Blocking message passing
Synchronous, sender blocks until message is received, receiver blocks until message is available
39
Non-blocking message passing
Asynchronous, sender sends message and continues, receiver receives valid message or null
40
Buffering
Queue of messages attached to the link
41
Buffering 3 implementations
zero capacity Bounded capacity - finite unbounded capacity - infinite
41
When timesharing is happening, what is each process essentially given?
A virtual CPU
42
What are two ways that OS organize all PCBs?
Array of structures: wasted memory space Array of pointers to dynamically allocated PCBs: overhead of dynamic memory management
43
Waiting list
Contains all processes blocked on a resource because the resource is not available
44
Ready List
List containing all processes that are in the ready state and thus are able to run on the CPU
45
When a process gets destroyed what happens to its PCB
Frees PCB data structure and removes any references to the PCB from the system
46
Resource Control Block
Data structure that represents a resource
47
Allocated Resource
A process has access to and is able to utilize the resource
48
Free resource
when it may be allocated to a requesting process
49
Can a process be blocked on more than one resource?
No
50
Scheduler Function
Determines which process should run next and starts the process
51
Concurrent Programming
Running several tasks at the same time
52
In theory, dividing a program into n smaller parts and running on n processes results in
n time speedup
53
Execution of concurrent tasks on single processor
Multithreaded programming
54
Execution of concurrent tasks on several processor in close proximity
Parallel Computing
55
Execution of concurrent tasks on several processors distributed across a network
Distributed computing
56
3 positives of using a single process with multiple threads
Faster Less overhead for creation, switching, termination Share same address space
57
Multithreading
The execution part is a "thread" that can be multiplied
58
Each thread of execution receives its own
Control block and stack, which includes own execution state, copy of cpu registers, execution history(stack)
59
Process identification data is per
process
60
thread identifiers is per
thread
61
CPU state information is per
thread
62
process control information-- scheduling is per
thread
63
Process control information, used memory and i/o, opened files, pointer to next pcb, is per
process
64
Process Spawning
Setting up PCB Allocation of address space Loading the program into the allocated address space Passing on the PCB to the scheduler
65
Threads are created _ processes, and _ to processes
within, belong
66
All threads created within one process, _ the resources of the process _ the address space
Share, include
67
Advantages of threads 3
Much quicker to create than a process Much quicker to switch between threads than to switch between processes Threads share data easily
68
Disadvantages of thread
Processes are more flexible (dont have to run on same processor No security between threads If one thread blocks, all threads block on user thread package
69
Thread Pools
Since unlimited threads will exhaust system resources, create a number of threads at process startup and put them in a pool where they await work
70
User-level thread implementation - kernel - pros -cons
The kernel is not aware of the existence of threads, it only processes with one thread of execution Each user process manages its own private thread table Pros: Light thread switching (no kernel mode privileges), cross platform Cons: If a thread blocks, the entire process is blocked, including all other threads in it
71
Kernel-level thread implementation -kernel -pros -cons
The kernel knows about and manages the threads: creating and destroying threads are system calls pros: find grain scheduling, done on a thread basis. If one thread blocks then it can pick another thread Cons: Heavy thread switching involving mode switch
72
Many to one multithread model
Several user-level threads mapped to a single kernel thread drawback: one blocks then all blocks, only one thread can access the kernel at a time
73
One to One multithreading model
Each user-level thread maps to a kernel thread drawback: need to create many threads
74
many to many multithreading model
Allows many user level threads to be mapped to a smaller number of kernel threads Allows OS to create a sufficient number of kernel threads
75
Hybrid multithreading model
Similar to many to many, but allows a user thread to be bound to a kernel thread
76
Asynchronous thread cancellation
Terminates the target thread immediately
77
Deferred cancellation
Allows the target thread to periodically check if it should be cancelled ( more controlled and safe)
78