Processes and Threads Flashcards

(78 cards)

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
each process has an associated _________ id
process
26
A child process as an exact _____ of its parent
copy
27
Typically, a child loads another program using the ____ syscall while the parent _____
exec(), waits
28
The syscall ____ returns twice. It returns 0 for a _____ process and is otherwise a _____ process
fork, child, parent
29
A process can be terminated if there are no more _______ or the parents terminates it
instructions
30
A parent may terminate a child when the child has exceeded ______, is no longer ______, is is exiting itself
resources, required
31
A _____ process is a terminated process, but the parent hasn't called wait()
zombie
32
An _____ process is a running process, but the parent exited without calling wait
orphan
33
A _____ is a basic unit if CPU utilization
thread
34
A thread is a sequence of _______ in a function which the CPU can execute as a unit
instructions
35
A thread is composed of a PC, _____ set, and ______
register, stack
36
A _____ is composed of one or more _____
process, threads
37
Threads belonging to the same process share....
code section, data section, OS resources
38
What are some example of multithreading?
* Web browsers: parallel downloads * Web servers: handle multiple concurrent clients * Word processors: spell check in the background
39
____ level threads are maintained in the user level, performed in user mode, is hidden from the kernel, and is provided by user-level libraries
User
40
_____ level threads have their operation in kernel mode and are provided by the OS
kernel
41
What are the 3 different mapping from user-level threads to kernel-level threads?
Many-to-one, One-to-one, and Many-to-many
42
In a Many-to-one mapping, many _______ threads are mapped to a single _____ thread
user-level, kernel
43
A __________ mapping makes managing user threads faster because there are no syscalls and no switching to kernel mode
Many-to-one
44
A con of the Many-to-one thread mapping is that when one thread ______, the entire process ______
blocks, blocks
45
In a _________ mapping, each user-level thread maps to a kernel thread
One-to-one
46
A benefit of the one-to-one mapping is that there is increased _________, and when one thread _____, others can run
concurrency, blocks
47
A con of the _________ mapping is that creating too many kernel threads may degrade performance since they consume OS resources, and thread management overheads
one-to-one
48
In a Many-to-many mapping, _____ user threads map to _______ kernel threads
multiple, multiple
49
Some benefits of the Many-to-many mapping is increased ________ and ______, as the user can create as many user threads they want
concurrency, flexibility
50
A con of the ________ mapping is that it is complex to implement
many-to-many
51
_________ ________ is a common thread library found in UNIX systems
POSIX Pthreads
52
The windows threads is an implementation of the _______ mapping in the kernel
one-to-one
53
_____ threads are managed by the JVM which is run on top of an OS
Java
54
What are 3 issues of threading?
* Semantics of fork() and exec() system calls * Signal handling * Thread pools
55
When should a fork() duplicate only the calling thread? Why?
If exec() is called, because exec() overrides all existing threads anyways
56
When should a fork() duplicate the entire process?
When exec() is not called
57
What is the difference between a synchronous and asynchronous signal?
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
____ are used in Unix to notify a process that an event has occurred
Signals
59
What is an example of a synchronous signal?
illegal memory access
60
What is an example of an asynchronous signal?
Ctrl-c
61
Describe the life cycle of a signal (3 steps)
* Signal is generated by an event * Signal is delivered to a process * Signal handler processes the signal (default by OS, or user-defined)
62
______ can choose to block signals
threads
63
A _______ signal should be sent to the thread that performed an an operation that caused the signal to be generated
synchronous
64
A _______ signal sent to all threads belonging to the process
asynchronous
65
An _______ is initiated by the CPU, I/O devices, or software while a _______ is initiated by the kernel or a process
interrupt, signal
66
Interrupts are handled by a very simple ____ in the _____
ISR, kernel
67
Signals are managed by the _______ or ____ process
kernel, user
68
The kernel map map some _______ to ________
interrupts, signals
69
A _____ _______ can be complex and call other functions in the kernel
signal handler
70
A ______ _____ is a set of threads that wait for work
thread pool
71
a web server serving many ______ may have a thread pool
requests
72
Servicing a request with an existing thread is ______ than creating a new one
faster
73
By ______ the number of threads in an application to a pool size, it is easier to manage _______
limiting, resources
74
In ______, all threads and processes are called tasks
Linux
75
In Linux, thread ______ is done though the clone system call
creation
76
The Linux clone can be changed to allow different _____ _______ possibilities
resource sharing
77
A benefit of Linux referring to all processes and threads as _____, is that it simplifies _________
tasks, scheduling
78
It is complex to correlate threads with their ________ when they are all referred to as tasks
processes