Processes and Threads Flashcards

Experiment 1

1
Q

What does POSIX mean?

A

Portable Operating System Interface for Unix.

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

What is an executable program?

A

In an operating system, it is one or several processes.

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

What is a trace?

A

It is the sequence of instructions within a process is represented.

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

What is a dispatcher?

A

It is an operating system process that selects the processes for execution.

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

What happens when a new process is created?

A

The operating system creates the necessary data structures for managing the processes and assigns an address space in the main memory.

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

What is the meaning of the ready state of a process?

A

It means that the process is waiting to be executed.

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

What is the meaning of the running state of a process?

A

It is running/executing in fact.

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

What is the meaning of the blocked state of a process?

A

A process is on this state when it is waiting for a specific operation (I/O, shared resource).

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

What is the meaning of exit state of a process?

A

Is the state of a terminated process.

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

What should be done when a process goes to the exit state?

A

It is necessary to delete the process information (if no longer needed) and maybe store the results into the main memory (if it is not done).

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

What could be the reasons for a process to terminate?

A

(INETO)

  1. Insufficient memory
  2. Normal termination
  3. Exceeding given time limit by the dispatcher
  4. Termination of/by parent process
  5. Operating System intervention
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where is the context of a process contained?

A

A context of a process is contained within the process image.

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

What does the process image contain?

A
(UP P UD SS)
User Program
Process Control Block
User Data
System Stack
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the process control block (PCB)?

A

PCB contains the necessary data to control the process.

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

What is the process control block (PCB) composed by?

A
The process control block (PCB) is composed of:
1. the PID
2. the processor state information
3. the process control information
(PID PSI PCI)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does processor state information contain?

A
Processor state information (PSI) contains 
register contents
control register
status register
stack pointers
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What does the process control information contains?

A

scheduling and state information
data structures (pointers to other process - child, parent, queues)
inter-process communication (signals, flags, messages pointer)
privileges (memory or use of auxiliary systems)
memory management (pointers)
resources

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

What is a user program?

A

Sequence of instructions for execution.

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

What is user data?

A

It is the modifiable part of the user space.

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

What is system stack?

A

It is a stack used to store parameters and calling addresses of system calls.

21
Q

What is a process?

A

Processes are units for both resource management and dispatching.

22
Q

What is a thread?

A

Threads (lightweight processes) are units for dispatching with smaller overhead.

23
Q

When a operating system is called multi-threading?

A

When the operating system allows the processes to use more than one thread.

24
Q

What should be added to the process image in a multi-thread system, compared to a single-thread?

A

The thread control blocks (TCB).

25
Q

What are the fundamental thread operations?

A
  1. Spawn
  2. Block
  3. Unblock
  4. Finish
26
Q

What is the spawn operation of a thread?

A

When a process is created, it also creates a new thread for this process. This thread can create several new threads within the process. For each thread the context has to be created.

27
Q

What is the block operation of a thread?

A

To put the thread on the blocking list, so it has to wait for an event.

28
Q

What is the Unblock operation of a thread?

A

To add the thread on the ready queue after an event occurs.

29
Q

What is the finish operation of a thread?

A

To release the allocated memory for the thread context when it terminates its execution.

30
Q

What does ULT stand for?

A

User-level Threads

31
Q

What does KLT stand for?

A

Kernel-level Threads

32
Q

What is the main difference between user-level threads and kernel-level threads?

A

User-level threads are managed by their application (process) while kernel-level threads the management is done by the kernel. Also, the creation and termination of a user-level thread is done via a thread library. On the other hand, when a kernel-level thread must be executed, the context switch consumes more time, since it has to change from user-space to kernel-space for the selection and then for its execution again to user-space.

33
Q

What is the ACTIVE state of a Linux process?

A

It is a state composed by two states: EXECUTING or READY to execute.

34
Q

What is the INTERRUPTIBLE state of a Linux process?

A

It is a blocked state in which the process is waiting for an event, such as the end of an I/O operation, the availability of a resource, or a signal from another process.

35
Q

What is the UNINTERRUPTIBLE state of a Linux process?

A

It is a blocked state that differs from INTERRUPTIBLE state because the process is waiting directly on hardware conditions and therefore will not handle any signals.

36
Q

What is the STOPPED state of a Linux process?

A

It is the state when the process has been halted and can only resume by positive action from another process.

37
Q

What is the ZOMBIE state of a Linux process?

A

It is when the process has been terminated but, for some reason, still has its process image in the process table. When the process image is deleted, the process is removed from the system.

38
Q

How does Linux distinguish threads and processes?

A

It does not. It provides an unique solution for both. User-level threads are mapped into kernel-level processes. Multiple user-level threads that constitute a single user-level process are mapped into Linux kernel-level processes that share the same group ID.

39
Q

What is a critical section?

A

It is a section of code within a process that requires access to shared resources and that may not be executes while another process is in a corresponding section of code.

40
Q

What does Mutual Exclusion mean?

A

Mutual Exclusion is the requirement that when one process is in a critical section that accesses shared resources, no other process may be in critical section that accesses any of those shared resources.

41
Q

What does (Condition) Synchronization mean?

A

(Condition) Synchronization means that not only the restricted access to shared resource is important but also the order of access.

42
Q

How can we ensure mutual exclusion and/or (condition) synchronization?

A

We can ensure using semaphores.

43
Q

What is a semaphore?

A

Semaphores are a mechanism without busy waiting to restrict the access to a critical section. (it does not pool from time to time to check if a resource is busy or not)

44
Q

Which is the composition of a semaphore?

A

Semaphore are data records composed of an integer value and a list of processes that contains the processes waiting to get the semaphore.

45
Q

How can we access the integer value of a semaphore?

A

We can access it only by two atomic functions: wait and signal.

46
Q

How do we initialize a semaphore?

A

With the function init().

47
Q

How does the wait() function works?

A

wait(S) decreases the value of the semaphore S and if the resulting value is non-negative the process gets the semaphore and can access the critical section, otherwise the process is added to the waiting queue.

48
Q

How does the signal() function works?

A

When a process finishes its execution within the critical section, the semaphore S is released with signal(S). The integer value of S is increased and if this new value is smaller than or equal to zero, a waiting process is chosen so that it can continue its execution within the critical section.