Chapter 4 Operating Sys Flashcards

1
Q

What is a thread?

A
  • Each execution path within a process is called a
    thread.
  • Every process has at least one thread of
    execution
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Process vs. Threads

A

Threads are the entities within a process
scheduled for execution on the CPU.

Every process has exactly one
program and every running program has at
least one thread of execution.

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

True or False:

A
  • Every process must have 1 or more programs.
  • A process may only have 1 thread of execution.
  • A thread may contain multiple programs.
  • If one thread blocks, a process may continue
    running other threads in its program
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is multithreaded?

A

Multithreaded processes are executed similarly to
multiprogramming of processes: the CPU is switched rapidly among the threads creating the illusion of parallel execution.

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

Possible Thread Transition?

A
  1. Thread blocks for input
  2. Scheduler picks another thread
  3. Scheduler picks this thread
  4. Thread becomes able to run
    again
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

pthread_create()

A

A new thread is created using the POSIX
pthread_create() call. The call to create specifies
the name of the procedure for the new thread to
run.

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

pthread_exit()

A

When a thread has finished the work it has been
assigned, it can terminate by calling
pthread_exit(). This call stops the thread and
releases its stack.

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

pthread_join()

A

Often a thread needs to wait for another thread
to finish its work and exit before continuing. The
thread that is waiting calls pthread_join() to wait
for a specific other thread to terminate.

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

pthread_yield()

A

If a thread wishes to relinquish its CPU time to allow
another thread to run, it can call pthread_yield().
No similar mechanism exists for processes. It is
assumed that processes “compete” for CPU time.
Threads, on the other hand, work in cooperation
with each other within a specific process. Therefore,
relinquishing the CPU to a sibling thread may be
advantageous to the process as a whole.

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