Chapter 4

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

1/14

flashcard set

Earn XP

Description and Tags

Threads

15 Terms

1
New cards

Process VS Thread

Independent

Address space

memory

PCB

creation

switching

communication

<p>Independent</p><p>Address space </p><p>memory </p><p>PCB </p><p>creation</p><p>switching</p><p>communication</p>
2
New cards

Benefits of threads

  1. May continue executing even if part of prcoess is blocked

  2. Cheap creation

  3. Scalabikity

  4. Resource sharing



3
New cards

Concurrency vs Parallelism

Concurency only one at a time

Parallelism run at same time

4
New cards

Types of Parallelism

Data: divide data

Task; different thread do different task

5
New cards

Amdahl’s Law

Identifies performance gains from adding additional cores to an application that has both serial and parallel components

• S is serial portion

• N processing cores

<p>Identifies performance gains from adding additional cores to an application that has both serial and parallel components</p><p> • S is serial portion </p><p>• N processing cores</p>
6
New cards

Multiprogramming challenges programmers face

  1. dividing challenge

  2. Data splitting

  3. data dependecy

  4. testing and debugging


7
New cards

3 Thread libraries

POSIX

Windows

Java

8
New cards

Kernel Threads

Windows

Solaris

Linux

Tru64

Max OSX

9
New cards

Pros and cons of User level threads

Pros

  • fast creation

  • simpler to control

  • switching does not need kernel level privelages

Cons

  • dont communicate well with OS kernel

  • does not matter if process is single or mutithreaded, still recives one slot

  • has to be non-blocking


10
New cards

Pros and cons of Kernel level threads

Pros

  • can scheduling diff instances on diff cpus

  • when thread halted, can scheduling another thread to do same task

Cons

  • slow

  • overhead

  • complex


11
New cards

Multithread models

Many-to-one (solaris green threads)

one-to-one (windows/linux/solaris 9)

many-to-many (windows/ solaris)

12
New cards

What is implicit threading

Creation and management of threads is done by the compiler and run-time libraries instead of programmer

13
New cards

Way to implicit threading

  1. Thread pool

  2. Open MP

  3. Grand Central Dispatch


14
New cards

Thread issues

  1. Semantics

  2. Signal handling

  3. Thread cancelations (Asynchronous / differed)

  4. Thread local storage

  5. Scheduling activations


15
New cards

Examples of threads

Windows

  • Windows API

  • ONE-TO-ONE

Linux

  • clone() creates threads