Chp 2 Process/Threads Flashcards

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
Q

What events trigger the OS to switch processes?

A

Interrupts: External, Asynchronous
Executions (traps): Internal, synchronous (but involuntary)
System calls (traps): Voluntary synchronous events after calling a specific OS service

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

Long term scheduler

A

Decides to add a program to the pool of processes to be executed (job scheduling)

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

Medium term scheduler

A

The decision to add to the number of processes that are partially or fully in main memory (swapping)

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

Short term scheduling

A

CPU scheduling, decides as to which available processes in memory are to be executed by the processor

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

Which scheduler controls the degree of multiprogamming

A

Long term scheduler

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

I/O bound process

A

spends more time in I/O than computations, many short CPU bursts

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

CPU-bound process

A

Spends more time doing computations, few very long CPU bursts

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

Which scheduler removes processes from memory “temporarily” to reduce degree of multiprogramming?

A

Medium term scheduler

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

Cooperating processes

A

Can affect or be affected by the execution of another process

33
Q

Two mechanisms for interprocess communication

A

Shared Memory
Message Passing

34
Q

What do P and Q need to establish if they want to communicate?

A

Communication Link

35
Q

Direct Communication

A

Processes must name each other explicitly

36
Q

Indirect Communication

A

Messages are directed and received from mailboxes (ports)

37
Q

Solutions to multiple processes on a mailbox

A

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
Q

Blocking message passing

A

Synchronous, sender blocks until message is received, receiver blocks until message is available

39
Q

Non-blocking message passing

A

Asynchronous, sender sends message and continues, receiver receives valid message or null

40
Q

Buffering

A

Queue of messages attached to the link

41
Q

Buffering 3 implementations

A

zero capacity
Bounded capacity - finite
unbounded capacity - infinite

41
Q

When timesharing is happening, what is each process essentially given?

A

A virtual CPU

42
Q

What are two ways that OS organize all PCBs?

A

Array of structures: wasted memory space
Array of pointers to dynamically allocated PCBs: overhead of dynamic memory management

43
Q

Waiting list

A

Contains all processes blocked on a resource because the resource is not available

44
Q

Ready List

A

List containing all processes that are in the ready state and thus are able to run on the CPU

45
Q

When a process gets destroyed what happens to its PCB

A

Frees PCB data structure and removes any references to the PCB from the system

46
Q

Resource Control Block

A

Data structure that represents a resource

47
Q

Allocated Resource

A

A process has access to and is able to utilize the resource

48
Q

Free resource

A

when it may be allocated to a requesting process

49
Q

Can a process be blocked on more than one resource?

A

No

50
Q

Scheduler Function

A

Determines which process should run next and starts the process

51
Q

Concurrent Programming

A

Running several tasks at the same time

52
Q

In theory, dividing a program into n smaller parts and running on n processes results in

A

n time speedup

53
Q

Execution of concurrent tasks on single processor

A

Multithreaded programming

54
Q

Execution of concurrent tasks on several processor in close proximity

A

Parallel Computing

55
Q

Execution of concurrent tasks on several processors distributed across a network

A

Distributed computing

56
Q

3 positives of using a single process with multiple threads

A

Faster
Less overhead for creation, switching, termination
Share same address space

57
Q

Multithreading

A

The execution part is a “thread” that can be multiplied

58
Q

Each thread of execution receives its own

A

Control block and stack, which includes own execution state, copy of cpu registers, execution history(stack)

59
Q

Process identification data is per

A

process

60
Q

thread identifiers is per

A

thread

61
Q

CPU state information is per

A

thread

62
Q

process control information– scheduling is per

A

thread

63
Q

Process control information, used memory and i/o, opened files, pointer to next pcb, is per

A

process

64
Q

Process Spawning

A

Setting up PCB
Allocation of address space
Loading the program into the allocated address space
Passing on the PCB to the scheduler

65
Q

Threads are created _ processes, and _ to processes

A

within, belong

66
Q

All threads created within one process, _ the resources of the process _ the address space

A

Share, include

67
Q

Advantages of threads 3

A

Much quicker to create than a process
Much quicker to switch between threads than to switch between processes
Threads share data easily

68
Q

Disadvantages of thread

A

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
Q

Thread Pools

A

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
Q

User-level thread implementation
- kernel
- pros
-cons

A

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
Q

Kernel-level thread implementation
-kernel
-pros
-cons

A

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
Q

Many to one multithread model

A

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
Q

One to One multithreading model

A

Each user-level thread maps to a kernel thread
drawback: need to create many threads

74
Q

many to many multithreading model

A

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
Q

Hybrid multithreading model

A

Similar to many to many, but allows a user thread to be bound to a kernel thread

76
Q

Asynchronous thread cancellation

A

Terminates the target thread immediately

77
Q

Deferred cancellation

A

Allows the target thread to periodically check if it should be cancelled ( more controlled and safe)

78
Q
A