Lecture Operating systems: Lesson 19 - Dr. Syed Mansoor Sarwar

Lecture Operating systems: Lesson 19 - Dr. Syed Mansoor Sarwar. The main topics covered in this lesson include: process synchronization, the critical section problem, conditions for a good solution, 2-process critical section problem solutions, bounded-buffer problem, race condition, bank transactions, . | Operating Systems Lecture 19 Syed Mansoor Sarwar Agenda for Today Review of previous lecture Process synchronization The Critical Section Problem Conditions for a Good Solution 2-Process Critical Section Problem Solutions Recap of lecture 28 April 2022 Copyright Virtual University of Pakistan Review of Lecture 18 UNIX System V scheduling algorithm Algorithm Evaluation Process Synchronization The Critical Section Problem 28 April 2022 Copyright Virtual University of Pakistan Bounded-Buffer Problem Producer process item nextProduced while 1 nextProduced getNewItem while counter BUFFER_SIZE buffer in nextProduced in in 1 BUFFER_SIZE counter 28 April 2022 Copyright Virtual University of Pakistan Bounded-Buffer Problem Consumer process item nextConsumed while 1 while counter 0 nextConsumed buffer out out out 1 BUFFER_SIZE counter- 28 April 2022 Copyright Virtual University of Pakistan Bounded-Buffer Problem counter in assembly language MOV R1 counter INC R1 MOV counter R1 counter- in assembly language MOV R2 counter DEC R2 MOV counter R2 28 April 2022 Copyright Virtual University of Pakistan Bounded-Buffer Problem If both the producer and consumer attempt to update the buffer concurrently the machine language statements may get interleaved. Interleaving depends upon how the producer and consumer processes are scheduled. 28 April 2022 Copyright Virtual University of Pakistan Bounded-Buffer Problem Assume counter is initially 5. One interleaving of statements is producer MOV R1 counter R1 5 INC R1 R1 6 consumer MOV R2 counter R2 5 DEC R2 R2 4 producer MOV counter R1 counter 6 consumer MOV counter R2 counter 4 The value of count may be either 4 or 6 where the correct 28 April 2022 result should be 5. Copyright Virtual University of Pakistan Process Synchronization Race Condition The situation where several processes access and manipulate shared data concurrently the final value of the data depends on which process finishes last. 28 April 2022 Copyright Virtual University

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.