Processes, LDEs & Threads Flashcards

1
Q

Time sharing

A

Running one program for a little while, then running another one, and so forth

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

What illusion does time sharing promote?

A

The illusion that many virtual CPUs exist

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

What is the consequence of time sharing promoting the illusion that many virtual CPUs exist?

A

Each program believes that it is using the CPU alone

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

Mechanisms

A

Low-level methods/protocols that implement a needed piece of functionality

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

Policies

A

Algorithms for making some kind of decision within the OS

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

Program/Executable file

A

A static entity stored on disk

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

Process

A

A running program

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

A program becomes a process when…

A

it is selected to execute and loaded into memory

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

Loading

A

Takes on-disk program and reads it into the address space of process

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

How does the OS run a program?

A

Loads code and any static data into memory
Allocates memory for the program’s run time stack
Initializes the stack with arguments
Allocates memory for the program’s heap
Initialization tasks + main()

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

What does a process consist of?

A

Address space
Code
Stack
Registers
Data
Heap

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

What does the address space that a process consists of contain?

A

Memory that the process can address

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

What does the stack that a process consists of contain?

A

Temporary data

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

What do the registers that a process consists of contain?

A

Program Counter, general purpose, stack pointer and frame pointer

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

Program Counter (PC)

A

Tells us which instruction the program will execute next

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

Stack pointer and frame pointer

A

Manage the stack for function parameters, local variables and return addresses

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

What does the data that a process consists of contain?

A

Global variables

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

What does the heap that a process consists of contain?

A

Dynamically allocated structures

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

How does the OS track the state of each process?

A

By keeping a process list

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

Register context

A

The contents of the registers of a stopped process

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

Where is each entry in a process list found?

A

Process Control Block (PCB)

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

What are the different process states?

A

INITIAL
READY
RUNNING
BLOCKED
ZOMBIE

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

INITIAL

A

The state a process is in when it’s being created

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

READY

A

The state a process is in when it’s ready to run and pending for running

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

RUNNING

A

The state a process is in when it’s being executed by the OS.

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

BLOCKED

A

The state a process is in when it’s suspended due to other events

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

ZOMBIE/FINAL

A

The state a process is in when it’s completed execution but still has an entry in the system

28
Q

SCHEDULED

A

A process that’s moved from READY to RUNNING

29
Q

DESCHEDULED

A

A process that’s moved from RUNNING to READY

30
Q

What do process APIs do?

A

Manipulate processes

31
Q

CREATE

A

When a process API creates new processes

32
Q

WAIT

A

When a process API waits for a process to stop running

33
Q

DESTROY

A

When a process API destroys the processes forcefully

34
Q

STATUS

A

When a process API obtains information about a process

35
Q

OTHERS

A

When a process API suspends/resumes a process

36
Q

What does process creation rely on in a Unix-like OS?

A

fork() and exec()

37
Q

fork()

A

Creates a new process and clones its parent process

38
Q

exec()

A

Allows a child to break free from its similarity to its parent and execute an entirely new program

39
Q

What does the following return value from a fork() system call indicate: non-zero PID

A

Return value of the parent process

40
Q

What does the following return value from a fork() system call indicate: zero

A

Return value of the new child process

41
Q

What does the following return value from a fork() system call indicate: - 1

A

An error/failure occurred when creating a new process

42
Q

What are the two differences between a parent and a child process?

A

PID and memory addresses

43
Q

wait()

A

Allows a parent to wait for its child to complete execution

44
Q

What does the shell consist of?

A

fork() + wait() + exec()

45
Q

Why do we have a process API?

A
  • Maintains the shell structure
  • Makes IO redirection and pipe possible
46
Q

Pipe

A

Communication method between two processes

47
Q

Why do we have processes?

A

To build applications using communication process; makes it possible for us to write applications that fully utilize many cores

48
Q

Limited Direct Execution (LDE)

A

Kernel initializes the trap table & the CPU remembers its location for subsequent use
Kernel set-up before using a return-from-trap instruction to start the execution of a process

49
Q

Kernel mode

A

The mode the OS runs in. In this mode, code that runs can do what it likes, including privileged operations.

50
Q

What does the system call allow the kernel to do?

A

Carefully expose certain key pieces of functionality to user programs

51
Q

Trap instruction

A

Simultaneously jumps into the kernel and raises the privilege level to kernel mode

52
Q

Return-from-trap instruction

A

Returns into the calling user program while simultaneously reducing the privilege level back to user mode

53
Q

Timer interrupt

A

A timer device that’s programmed to raise an interrupt every so many ms.

54
Q

Context switch

A

When the OS switches processes

55
Q

What does the disable interrupts mechanism in LDE ensure?

A

Concurrency; when one interrupt is being handled, no other one while be delivered to the CPU

56
Q

What does the locking scheme mechanism in LDE enable?

A

Concurrency; multiple activities can be on-going within the kernel at the same time

57
Q

Why do we use threads?

A

To enable inter-process communication

58
Q

What do threads share?

A

The same address space

59
Q

What do multiple threads within a process share?

A

Process ID
Address space
Open files
Current working directory

60
Q

Each thread has its own:

A

Thread ID
Set of registers
Stack for local variables & return addresses

61
Q

What is a process in a OS?

A

A running program with an address space

62
Q

What do we use process APIs for?

A

Creating and managing processes

63
Q

On Unix-like systems what to we use fork() to do?

A

Duplicate a process

64
Q

On Unix-like systems what do we use exec() to do?

A

Replace a command

65
Q

What are threads?

A

Lightweight processes