Remaining review Flashcards

1
Q

What information is in the PCB?

A
  • process state
  • application code, data, files
  • virtual address space and mapping
  • stack
  • registers

Thus when splitting up, it only contains the address space and mappings

Limitations for single PCB (when full): 
Scalability 
Overheads 
Performance 
Flexibility
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What do each of the data structures from the SOLARIS papers contain?

ULT 
KLT 
Process (PCB) 
CPU 
LWP
A

CPU:

  • current KLT
  • list of KLTs (threads that run there)

Process:

  • list of KLTs
  • virtual address space
  • signal handlers
  • user credentials

KLTs:

  • kernal registers
  • pointers to LWP and CPU
  • Stack pointer
  • Scheduling info

LWP:

  • user-level registers
  • system call arguments
  • signal masks
  • resource usage info
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What allows for thread management between the ULTs and the kernel when either doesn’t know how many threads are available on each side?

A

Thus, system calls and special signals allow the kernel and ULT library to interact and coordinate

ex) pthread_setconcurrency

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

Benefits and Negatives of 1-1 KLT and ULT mapping

A

Benefits:
- know exactly how many threads dealing with on both sides
- easier to manage threads
Drawbacks:
- must go through the kernel every time and pay cost of system call
- relying on the mechanisms and policies of the kernel

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

Benefits and Negatives of many-1 KLT and ULT mapping

A

Benefits:
- portable and doesn’t depend on OS limits
Drawbacks:
- OS has no insight to application needs
- OS may block entire process if one ULT thread blocks on I/O

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

Benefits and Negatives of many-many KLT and ULT mapping

A

Benefits:
- You get the best of both 1-1 and many-1
Drawbacks:
- Requires extra coordination between ULTs and KLTs -

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

Situation:
T1 ULT is currently mapped to T1 thread on kernel and holds a mutex lock
The other ULTs are blocked
ULT T4 holds the T4 kernel thread and wants the mutex

Why does length of critical section of mutex matter in this situation?

A

FOR SHORT CRITICAL SECTIONS, DON’T LOCK BUT SPIN

AND FOR LONG CRITICAL SECTIONS, DEFAULT BEHAVIOR IS TO BLOCK

Use adaptive mutexes for this

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

T/F -> Interrupts can be directed to any CPU that has them enabled

A

True

We may set interrupt on just a single core - the single core is designated for handling the interrtupts
Avoids overheads and pertubations on all other cores
This results in improved performance

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

What are the types of signals?

A

Types of Signals:
1) one-shot signals -> “n signals pending == 1 signal pending” : at least once
Must be explicitly re-enabled
Future instances of this signal will be handled by the default OS handlers or ignored
2) real-time signals -> if n signals raised, then handler is called n times as well
Queuing behavior instead of overriding behavior

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

What are the top and bottom halfs of interrupt handlers?

A

This is an optimization for hanlder interrupts where the interrupt is divided into 2 sections:

Top:

  • Minimum amount of processing
  • Fast and nonblocking

Bottom:
- Arbitrary complexity

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

How does the ULT library and the kernel work together to handle signals that are enabled on some threads, but not the ULT thread currently mapped to the KLT?

A
  • there’s a special ULT lib routine for handling the signal where it has knowledge of all the ULTs that can handle
  • It can make another ULT handle the signal that has the signal maks enabled (this is especially simple when the ULT that can handle is unbound)
  • In the case that the ULT that can handle is bound to a KLT, the ULT lib makes a system call to the KLT thread of the ULT that can handle. The KLT then goes back to the ULT lib handler and then makes the ULT that has enabled handle the signal.
  • in some cases if all ULTs are disabled for a handler, the there is a cycle that takes that eventually leads to all KLTs disabling the signal masks as well
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a task in Linux? What is in the task structure?

A

execution context of a KLT

task structure
- pid
- task group id 
- mm_struct
- files_struct
- list_head (list of tasks affiliated with a single process)
- cpus_allowed 
Tasks share portions of the address space via some pointer data structures (mm, files)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How is a new task created in linux? What do the sharing flags do?

A

clone()
Sharing flags dictate which portion of the state of the tasks will be shared between the parent and the child task - different values when set or cleared

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

Why does Linux use the 1-1 KLT to ULT mapping?

A

Kernel sees every ULT
Kernel traps are much cheaper
More resources: memory, large ranges of ID’s,
No overhead for searching for enabled mask

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