Api specifies behavior of the thread library

Info icon This preview shows pages 14–23. Sign up to view the full content.

View Full Document Right Arrow Icon
API specifies behavior of the thread library, implementation is  up to development of the library Common in UNIX operating systems (Solaris, Linux, Mac OS X)
Image of page 14

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4.15 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Pthreads Example
Image of page 15
4.16 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Pthreads Example (Cont.)
Image of page 16

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4.17 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Pthreads Code for Joining 10 Threads
Image of page 17
4.18 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Implicit Threading Growing in popularity as numbers of threads increase,  program correctness more difficult with explicit threads Creation and management of threads done by compilers and  run-time libraries rather than programmers Three methods explored Thread Pools OpenMP Grand Central Dispatch Other methods include Microsoft Threading Building Blocks  (TBB), java.util.concurrent package
Image of page 18

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4.19 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Thread Pools Create a number of threads in a pool where they await work Advantages: Usually slightly faster to service a request with an existing  thread than create a new thread Allows the number of threads in the application(s) to be  bound to the size of the pool Separating task to be performed from mechanics of  creating task allows different strategies for running task i.e.Tasks could be scheduled to run periodically Windows API supports thread pools:
Image of page 19
4.20 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Threading Issues Semantics of  fork()  and  exec()  system calls Signal handling Synchronous and asynchronous Thread cancellation of target thread Asynchronous or deferred Thread-local storage Scheduler Activations
Image of page 20

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4.21 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Semantics of fork() and exec() Does  fork() duplicate only the calling thread or all  threads? Some UNIXes have two versions of fork exec() usually works as normal – replace the running  process including all threads
Image of page 21
4.22 Silberschatz, Galvin and Gagne  © 2013 Operating System Concepts – 9 th  Edition Signal Handling Signals  are used in UNIX systems to notify a process that a  particular event has occurred.
Image of page 22

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 23
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern