M6: Threads and Concurrency Control - Managing Multiple Tasks at the Same Time Flashcards

1
Q

Open file descriptor table:

A

contains all the files that have been opened by a

process; stored in the PCB

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

Page table:

A

contains all the mappings from virtual to physical address space;
a pointer to the page table is stored in the process PCB

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

Thread

A

created within a process;
enables splitting an executing program into multiple simultaneously or pseudo-simultaneously running tasks to keep the CPU cores busy by having them run in parallel;
each thread has its own execution context, though the heap memory, static data segment, and code segment of the virtual memory, as well as the open files, are shared with the process

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

Thread table:

A

stores the execution context of the threads, which includes the thread processor registers, stack pointer, program counter, MMU, general registers, and stack memory segments

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

Thread pool:

A

where you pre-create a number of threads in the system, and what you do is whenever a client comes in, you take one of the idle threads to service the client; after the client request has been serviced, then the thread is returned to the pool and it’s available for servicing future clients

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

Thread affinity:

A

CPU cores have caches and in multicore systems, if threads keep getting run on the same core, then their data will be more likely to be cached; thus, threads should always run on a specific core

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

User level threads:

A

the thread library is located in user space; the OS does is not aware of the threads

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

Kernel level threads:

A

the thread library is located in kernel space; each

thread is handled and scheduled individually

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

Virtual dynamic shared objects

A

allows user space to handle certain kernel space routines, to reduce the need for context switching; memory allocated in user space

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

Concurrency control:

A

managing the interleaved execution of multiple

processes that access the same shared states, to produce the correct results

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

Race conditions

A

two or more threads or processes attempt to access and update the same data at the same time; the result of a computation depends on the exact timing of the multiple processes or threads being executed

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

Synchronization

A

implementing coordination between processes

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

Critical section:

A

a portion of code that involves an access or

modification of shared state

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

Mutual exclusion

A

enforcing that only one process is in any given

critical section at a time

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

Progress :

A

if no process is currently in the critical section, and at least one process wants to enter it, some process will eventually be able to enter

If no process is executing in its critical section and
some processes want to enter their corresponding
critical sections, then
1. Only those processes that are waiting to enter
can participate in the competition (to enter
their critical sections) and no other processes
can influence this decision.
2. This decision cannot be postponed indefinitely
(i.e., finite decision time). Thus, one of the
waiting processes can enter its critical section.

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

Bounded waiting

A

a process that is waiting in line to enter the critical
section will not be waiting indefinitely, and is guaranteed to have an opportunity to enter

 After a process made a request to enter its
critical section and before it is granted the
permission to enter, there exists a bound on
the number of turns that other processes are
allowed to enter.

17
Q

Busy-wait:

A

a loop checking the same condition repeatedly; the process busy-waiting cannot proceed until the condition becomes true; consumes CPU resources inefficiently

18
Q

Disabling interrupts:

A

an overly powerful approach to implementing
synchronization that prevents the OS from performing all context switches, which are caused by interrupts
In case of multicore would need to disable interrupts for all CPUs

19
Q

Atomic statements:

A

the compiler can translate such a statement to one line

of assembly language, thus making this an uninterruptible statement

20
Q

Deadlock

A

processes are waiting for each other, such that none of them can proceed

21
Q

For what is Process Abstraction useful

A

The process abstraction allows the operating system to track and switch between many running processes.

22
Q

What is stored per Thread in Thread Table

A
PC
SP
Stack
Global
Registers
MMU
23
Q

Difference between pthread_exit and return

A

If pthread_exit is called in main, the main thread terminates, while other threads (if any) will continue. This is different from calling return or exit from main, where all other threads will also be terminated.

24
Q

Aspects a solution to handle a Critical Section must have

A
  • Mutual Exclusion
  • Progress -> no Deadlock
  • Bounded Waiting -> no Starvation
25
Q

Roles of processes

A
  1. Container of resources: memory/open files, isolation of one process from another
  2. Execution context: bookmark for process, i.o. to resume later/context switch
26
Q

If at no time two processes are in a critical section simultaneously, would there be race conditions?

A

No

27
Q

Impact of Disabling Interrupts

A

Avoids race conditions. However clock interrupt is also turned off and therefore scheduler cannot be invoked.
Hence, all process are blocked, also the ones that do not want to enter Critical Section.