1 / 37

Operating Systems

Operating Systems. Exam 2 today can use single sheet. Sassn4 - due 1 Nov wassn6 - e/c 25 Oct. Concurrent Processes. IV. Parallel Processing. multi-tasking only simulates concurrency by interleaving execution. Concurrent Processes. Parallel Processing is true concurrency

Download Presentation

Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Operating Systems Exam 2 today can use single sheet Sassn4 - due 1 Nov wassn6 - e/c 25 Oct

  2. Concurrent Processes IV. Parallel Processing multi-tasking only simulates concurrency by interleaving execution

  3. Concurrent Processes Parallel Processing is true concurrency (“at the same time”)

  4. Concurrent Processes E. Process Synchronization manage competition control access to a “critical region”

  5. Operating Systems signs on the “critical region”

  6. Operating Systems

  7. Concurrent Processes manage competition analogy: raising hands in class

  8. Concurrent Processes Without process synchronization “bad things” can happen … eg, the “missed waiting customer”

  9. Concurrent Processes example:

  10. Concurrent Processes your number is called clerk is interrupted next clerk advances # you’re missed!

  11. Concurrent Processes “race condition” two people access same ATM account and deposit money …

  12. Concurrent Processes E. Process Synchronization semaphores

  13. Concurrent Processes semaphores “signals” when a resource is available

  14. Concurrent Processes semaphores ensure mutual exclusion to the critical code regions with test & increment

  15. Concurrent Processes semaphores P - test before using resource V - incrementwhen releasing

  16. Concurrent Processes semaphores P - test P(s): if s > 0 s-- V - increment V(s): s++

  17. Concurrent Processes P & V are executed by the OS in response to a process’ request for a resource If semaphore=0, then process must wait If semaphore>0, then can use the resource

  18. Concurrent Processes example: use the printer semaphore_prn := 1 // available P(semaphore_prn) // one cycle if > 0 s-- and allow to use finished with printer V(semaphore_prn) // one cycle s++

  19. Concurrent Processes control access to a “critical region” key: determine what is the critical region (what code)

  20. Concurrent Processes F. Process Cooperation two processes knowingly cooperate

  21. Concurrent Processes requires mutual exclusion and synchronization implement with semaphores

  22. Concurrent Processes 1. producers and consumers speed and synchronization problems possible

  23. Streaming Audio server client Buffer Producer Consumer ideal situation - processes are synchronized

  24. Streaming Audio server client Buffer Producer Consumer bad situation - buffer overrun

  25. Streaming Audio Because buffer holds finite amount of data, synchronization process must delay producer from generating more data when buffer is full.

  26. Producers and Consumers : One Process Produces Some Data that Another Process Consumes Later. Buffer Producer Consumer Buffer Producer Consumer Buffer Producer Consumer

  27. Streaming Audio server client Buffer Producer Consumer bad situation - empty buffer

  28. Streaming Audio Because buffer is empty must delay consumer from retrieving data

  29. Streaming Audio This synchronization task can be implemented by 3 semaphores: - Indicate number of full positions in buffer. - Indicate number of empty positions in buffer. - Mutex, will ensure mutual exclusion between processes

  30. Indicate number of full positions in buffer. • Indicate number of empty positions in buffer. • Mutex, will ensure mutual exclusion between processes

  31. Concurrent Processes G. Concurrent Programming 1. explicit parallelism

  32. Concurrent Processes programmer must indicate what can done in parallel example: COBEGIN and COEND stmts

  33. Concurrent Processes fParabola = 3*x^2 + 15*x – 7; COBEGIN temp1 = x^2; // performed by processor 1 concurrently temp2 = 15*x; // performed by processor 2 concurrently COEND

  34. Concurrent Processes G. Concurrent Programming 2. implicit parallelism

  35. Concurrent Processes compiler determines parallelism difficult job :-)

  36. Operating Systems

  37. Exam #2 here it comes … have a nice day :-)

More Related