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

Lecture Operating systems: Lesson 20 - Dr. Syed Mansoor Sarwar. The main topics covered in this lesson include: 2-process critical section problem (continued), n-process critical section problem, the bakery algorithm, data structures, design a protocol to serialize executions of critical sections, . | Operating Systems Lecture 20 Syed Mansoor Sarwar Agenda for Today Review of previous lecture 2-Process Critical Section Problem continued n-Process Critical Section Problem The Bakery Algorithm Recap of lecture 28 April 2022 Copyright Virtual University of Pakistan Review of Lecture 19 Process Synchronization The Critical Section Problem 2-Process Critical Section Problem Solutions 28 April 2022 Copyright Virtual University of Pakistan Algorithm 3 Combined shared variables of algorithms 1 and 2. boolean flag 2 Set to false int turn 0 28 April 2022 Copyright Virtual University of Pakistan Algorithm 3 Process Pi do flag i true turn j while flag j amp amp turn j critical section flag i false remainder section while 1 28 April 2022 Copyright Virtual University of Pakistan Algorithm 3 Meets all three requirements Mutual Exclusion turn can have one value at a given time 0 or 1 Bounded-waiting At most one entry by a process and then the second process enters into its CS 28 April 2022 Copyright Virtual University of Pakistan Algorithm 3 Progress Exiting process sets its flag to false comes back quickly and set it to true again but sets turn to the number of the other process 28 April 2022 Copyright Virtual University of Pakistan n-Process Critical Section Problem Consider a system of n processes P0 P1 . Pn-1 . Each process has a segment of code called a critical section in which the process may change shared data. 28 April 2022 Copyright Virtual University of Pakistan n-Process Critical Section Problem When one process is executing its critical section no other process is allowed to execute in its critical section. The critical section problem is to design a protocol to serialize executions of critical sections. 28 April 2022 Copyright Virtual University of Pakistan Bakery Algorithm By Leslie Lamport Before entering its critical section process receives a ticket number. Holder of the smallest ticket number enters the critical section. If processes Pi and Pj receive the .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU XEM NHIỀU
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.