Chpt 4 Threads and Concurrency

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/31

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 8:44 PM on 2/5/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

32 Terms

1
New cards

How many processor does a sequential program use?

1

2
New cards

how do multiple processes work

difference processes can run on serparate processors and/or perform separate tasks

3
New cards

what is the most efficient IPC mechanism to share resources. and why

Shared Memory. no system call after inital set up, no copying between buffers

4
New cards

What are the cons of shared memory

  1. needs explicit set up to enable to share memory

  2. Creating and destroying process is expensive since it needs to allocate resoruces for new process to execute it

  3. Switching (context) between process is expensive since it requires saving one process and loading another.

5
New cards

Is a program counter a thread resource

Yes

6
New cards

Is an instruction register a thread resource

Yes

7
New cards

Is condition code register a thread resouce

Yes

8
New cards

Is a stack pointer a thread resource

Yes

9
New cards

Is stack a thread resource

Yes

10
New cards

Is CPU register a thread resource

Yes

11
New cards

Is address space process specific resource

Yes

12
New cards

Is code process specific resource

Yes

13
New cards

Is data process specific resource

Yes

14
New cards

Is heap process specific resource

Yes

15
New cards

Is memory process specific resource

Yes

16
New cards

Is cache process specific resource

Yes

17
New cards

Where are threads created destroyed and managed including context switching

Kernel space

18
New cards

Where does kernal maintain thread specific information

Thread control block (TCB)

19
New cards

Advantages of user level threads

Low Overhead

  • cheaper to create destroy and mangae

  • no mode switch required

Flexible scheduling

  • thread can be tailored to the needs of app. to maximize performance

20
New cards

Disadvantages of user level threads

No parallelism

  • one thread can be run at a time

  • only one CPU is used even if multiple CPUs

Dependent Progress

  • one thread process invokes blocking operation then entire process is blocked

  • one for all and all for one

21
New cards

Advantages of kernel level threads

Optimal CPU Utilization

  • each thread of a process can be possibly run on a separate processor

Independent Progress

  • if one thread of a process invokes a blocking operation, then only that thread of the process is blocked

    • To Each its Own!

22
New cards

Disadvantages of kernel level threads

High Overhead

  • expensive to create destroy and manage

    • 2 mode switches required for each operation

23
New cards

Which one defines Many-to-one

User-level threading in which process only has user level threads

24
New cards

Which one defines One-to-one

Kernal-level threading in which process only has kernal level threads

25
New cards

Which one defines Many-to-many

Hybrid threading in which process has both user-level and kernel-level threads

26
New cards

Which thread abstraction model is hard to implement

Many-to-many

27
New cards

What does asynchronous cancellation do?

Thread is canceled immediately

28
New cards

What does deferred cancellation do?

Thread is notified to cancel itself by setting a flag which is read by the thread periodically

  • desirable if the thread is the middle of modifying shared data and canceling it immediately may corrupt the data

29
New cards

If a thread has its own separate copy for certain variables what is it stored as

static data

30
New cards

How does a thread having its own copy for certain varaibles help improve performance

performing compiler level optimization

31
New cards

how to create a thread pool

collection of worker threads once and select a free thread to performa a specific task when needed

32
New cards

how does thread pools improve performance of application

new tasks arrive/are generated at run time which eliminates overhead of creating and destroying threads at run time