Processes and Threads Flashcards

1
Q

A program in execution has at least a ______ counter, ____, and ___section

A

program, stack, data

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

The stack in a process contains local _______ and function _______ ________

A

variables, return, addresses

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

The ______ in a process is dynamically allocated

A

heap

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

The data section in a process contains _______ variables

A

global

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

A ___ process was just created

A

new

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

A _____ process is waiting for CPU to become available

A

ready

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

A running process is having its ________ being executed by the CPU

A

instructions

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

A waiting process is waiting for ___ or an ______

A

I/O, event

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

A ________ process is done executing

A

finished

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

A ______ ______ ______ allows the OS to maintain info about a process

A

Process control block

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

A PCB contains info about…

A
  • Process state
  • Program counter
  • CPU registers
  • CPU scheduling info
  • Memory-management info
  • Accounting info
  • I/O status info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

A PCB is used to switch the _____ from one process to another

A

CPU

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

The PCB in linux the represented by the ________

A

task_struct

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

The processor _______ job is the switch between processes onto the CPU for time sharing

A

schedulers

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

What two scheduling queues are processes maintained in?

A

Ready queue and device queue

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

The _____ queue contains processes residing in main memory that are ready to execute

A

ready

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

The device queue contains processes waiting for an ___ _______

A

I/O device

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

What are the four reasons a process may be kicked out of been currently executed?

A
  • I/O request
  • Time slice expired
  • Fork a child
  • Wait for an interrupt
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

A _____ ______ is when the CPU core switches from one process to another

A

context switch

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

____ describes the values of the CPU register

A

state

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

When a context switch occurs, P0’s state is stored in _____ and P1’s ____ is loaded from PCB 1 into registers

A

PCB0, state

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

The time it takes for a context switch is pure ______

A

overhead

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

Some hardware supports very quick context switches by simply change the value of a ______

A

pointer

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

_____ processes can create children processes using the _____ syscall

A

parent, fork

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

each process has an associated _________ id

A

process

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

A child process as an exact _____ of its parent

A

copy

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

Typically, a child loads another program using the ____ syscall while the parent _____

A

exec(), waits

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

The syscall ____ returns twice. It returns 0 for a _____ process and is otherwise a _____ process

A

fork, child, parent

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

A process can be terminated if there are no more _______ or the parents terminates it

A

instructions

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

A parent may terminate a child when the child has exceeded ______, is no longer ______, is is exiting itself

A

resources, required

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

A _____ process is a terminated process, but the parent hasn’t called wait()

A

zombie

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

An _____ process is a running process, but the parent exited without calling wait

A

orphan

33
Q

A _____ is a basic unit if CPU utilization

A

thread

34
Q

A thread is a sequence of _______ in a function which the CPU can execute as a unit

A

instructions

35
Q

A thread is composed of a PC, _____ set, and ______

A

register, stack

36
Q

A _____ is composed of one or more _____

A

process, threads

37
Q

Threads belonging to the same process share….

A

code section, data section, OS resources

38
Q

What are some example of multithreading?

A
  • Web browsers: parallel downloads
  • Web servers: handle multiple concurrent clients
  • Word processors: spell check in the background
39
Q

____ level threads are maintained in the user level, performed in user mode, is hidden from the kernel, and is provided by user-level libraries

A

User

40
Q

_____ level threads have their operation in kernel mode and are provided by the OS

A

kernel

41
Q

What are the 3 different mapping from user-level threads to kernel-level threads?

A

Many-to-one, One-to-one, and Many-to-many

42
Q

In a Many-to-one mapping, many _______ threads are mapped to a single _____ thread

A

user-level, kernel

43
Q

A __________ mapping makes managing user threads faster because there are no syscalls and no switching to kernel mode

A

Many-to-one

44
Q

A con of the Many-to-one thread mapping is that when one thread ______, the entire process ______

A

blocks, blocks

45
Q

In a _________ mapping, each user-level thread maps to a kernel thread

A

One-to-one

46
Q

A benefit of the one-to-one mapping is that there is increased _________, and when one thread _____, others can run

A

concurrency, blocks

47
Q

A con of the _________ mapping is that creating too many kernel threads may degrade performance since they consume OS resources, and thread management overheads

A

one-to-one

48
Q

In a Many-to-many mapping, _____ user threads map to _______ kernel threads

A

multiple, multiple

49
Q

Some benefits of the Many-to-many mapping is increased ________ and ______, as the user can create as many user threads they want

A

concurrency, flexibility

50
Q

A con of the ________ mapping is that it is complex to implement

A

many-to-many

51
Q

_________ ________ is a common thread library found in UNIX systems

A

POSIX Pthreads

52
Q

The windows threads is an implementation of the _______ mapping in the kernel

A

one-to-one

53
Q

_____ threads are managed by the JVM which is run on top of an OS

A

Java

54
Q

What are 3 issues of threading?

A
  • Semantics of fork() and exec() system calls
  • Signal handling
  • Thread pools
55
Q

When should a fork() duplicate only the calling thread? Why?

A

If exec() is called, because exec() overrides all existing threads anyways

56
Q

When should a fork() duplicate the entire process?

A

When exec() is not called

57
Q

What is the difference between a synchronous and asynchronous signal?

A

A synchronous signal is delivered to the same process that performed the operation that caused the signal. An asynchronous signal is generated by an external event, usually delivered to a different process

58
Q

____ are used in Unix to notify a process that an event has occurred

A

Signals

59
Q

What is an example of a synchronous signal?

A

illegal memory access

60
Q

What is an example of an asynchronous signal?

A

Ctrl-c

61
Q

Describe the life cycle of a signal (3 steps)

A
  • Signal is generated by an event
  • Signal is delivered to a process
  • Signal handler processes the signal (default by OS, or user-defined)
62
Q

______ can choose to block signals

A

threads

63
Q

A _______ signal should be sent to the thread that performed an an operation that caused the signal to be generated

A

synchronous

64
Q

A _______ signal sent to all threads belonging to the process

A

asynchronous

65
Q

An _______ is initiated by the CPU, I/O devices, or software while a _______ is initiated by the kernel or a process

A

interrupt, signal

66
Q

Interrupts are handled by a very simple ____ in the _____

A

ISR, kernel

67
Q

Signals are managed by the _______ or ____ process

A

kernel, user

68
Q

The kernel map map some _______ to ________

A

interrupts, signals

69
Q

A _____ _______ can be complex and call other functions in the kernel

A

signal handler

70
Q

A ______ _____ is a set of threads that wait for work

A

thread pool

71
Q

a web server serving many ______ may have a thread pool

A

requests

72
Q

Servicing a request with an existing thread is ______ than creating a new one

A

faster

73
Q

By ______ the number of threads in an application to a pool size, it is easier to manage _______

A

limiting, resources

74
Q

In ______, all threads and processes are called tasks

A

Linux

75
Q

In Linux, thread ______ is done though the clone system call

A

creation

76
Q

The Linux clone can be changed to allow different _____ _______ possibilities

A

resource sharing

77
Q

A benefit of Linux referring to all processes and threads as _____, is that it simplifies _________

A

tasks, scheduling

78
Q

It is complex to correlate threads with their ________ when they are all referred to as tasks

A

processes