Midterm Flashcards

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
Q

Is context switching useful work?

A

No

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

Is there a difference between a new process and the other processes? can you tell this is a new one?

A

if OS has a toll how long a process has been run for, but otherwise they are very similar

27
Q

Process Context Switching 7 steps

A
  • 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
Q

What events trigger OS to switch processes? 3

A

Interrupts
Exceptions
System Calls

29
Q

Interrupts event

A

External, asynchronous events, independent of the currently executing process instructions

30
Q

Exceptions events

A

Traps, internal synchronous (but involuntary) events caused by instructions: OS may terminate or recover process

31
Q

System Call events

A

Traps, voluntary synchronous events calling a specific OS service.

32
Q

Job queue

A

Set of all jobs in the system

33
Q

Ready Queue

A

Set of all processes residing in main memory, ready and waiting to execute

34
Q

Device Queue

A

Set of processes waiting for I/O device

35
Q

Long term scheduler

A

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

36
Q

Medium term scheduling

A

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

37
Q

Short term scheduling

A

CPU Scheduling, the decision as to which available processes in memory are to be executed by the processor (dispatching)

38
Q

Draw scheduler pic

A

process 31

39
Q

Long term scheduler controls

A

the degree of multiprogramming

40
Q

Which scheduler is invoked more frequently?

A

Short term scheduler

41
Q

io bound process vs cpu bound process

A

io bound spends more time doing io than computations, many short cpu bursts, and vice versa

42
Q

examples of io bound and cpu bound

A

chat applications, interactions // photo editors, gaming

43
Q

What does Long term scheduler have to do

A

Needs to make careful decisions, decides what comes and stays on system at current time, decides when process terminates

44
Q

What happens if io scheduled first, what if cpu scheduled first?

A
  • 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
Q

swapping

A

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
Q

Mechanisms for processes to communicate and synchronize their actions

A

Shared memory
Message passing

47
Q

Shared memory

A

By using the same address space and shared variables

48
Q

Message Passing

A

Processes communicate with each other without resorting to shared variables

49
Q

Message passing - direct communication

A

Processes know who they are talking to. They must name each other explicitly

50
Q

Message Passing - indirect communication

A

Processes dont know who they are talking to. Messages are directed and received from mailboxes

51
Q

Message passing - blocking

A

Synchronous, The sender blocks until the message is received, the receiver blocks until the message is available. Ex:

52
Q

Message Passing - Non-blocking

A

Asynchronous, sender send message and continues, receiver receives a valid message or null Ex: streaming service, drone sending signal

53
Q

What to do with multiple messages

A

Use Buffer, queue of messages attached to the link, implemented in zero, bounded, or unbounded

54
Q

Time sharing, each process is given a

A

Multiple processes running on one physical cpu. Virtual CPU

55
Q

Virtual CPU

A

A cpu that the process assumes is available only to itself

56
Q

Benefits of virtual cpu 3

A

Multi user support
Multi CPU transparency
Portability

57
Q

Two ways to organize PCBs

A

Array of Structures -> wasted memory
Array of pointers to dynamically allocated PCBs -> overhead of dynamic memory management

58
Q

Waiting list

A

Contains all processes blocked on a resource

59
Q

Ready List

A

Contains all processes that are in ready state and able to run on CPU

60
Q

A resource is allocated to a process if

A

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

61
Q

A resource is free if

A

the resource may be allocated to a requesting process

62
Q

Scheduler function

A

Determines which process should run next and starts the process

63
Q
A