PPT-Lecture 11 PA2 , lock, and CV
Author : mudth | Published Date : 2020-07-03
Lab 3 Demand Paging I mplement the following syscalls xmmap xmunmap vcreate vgetmem vfreemem srpolicy Deadline March 22 2015 1000 PM Demand Paging
Presentation Embed Code
Download Presentation
Download Presentation The PPT/PDF document "Lecture 11 PA2 , lock, and CV" is the property of its rightful owner. Permission is granted to download and print the materials on this website for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Lecture 11 PA2 , lock, and CV: Transcript
Lab 3 Demand Paging I mplement the following syscalls xmmap xmunmap vcreate vgetmem vfreemem srpolicy Deadline March 22 2015 1000 PM Demand Paging OS From the OS perspective. Slide . 1. Too Much Milk With Locks. Both threads:. struct. lock l;. .... l. ock_acquire. (&l);. if (milk == 0) . {. . . buy_milk. ();. }. lock_release. (&. l);. CS 140 Lecture Notes: Locks. Slide . 1. Too Much Milk With Locks. Both threads:. struct. lock l;. .... l. ock_acquire. (&l);. if (milk == 0) . {. . . buyMilk. ();. }. lock_release. (&. l);. CS 140 Lecture Notes: Locks. IME 20051164 Junghee Pyeon. IME 20051206 Wootaek Hwang. IME. . 20051214 Joonhyung Ahn. CONTENTS. Company & Product Overview. Company Overview. Product Overview. Business Analysis. Slide . 1. Uniprocessor . Locks. void . lock_acquire. (. struct. lock *l) {. . intr_disable. ();. if (!l->locked) {. l->locked = 1;. } else {. . queue_add. (&l->q, . Slide . 1. Uniprocessor . Locks. void . lock_acquire. (. struct. lock *l) {. . intr_disable. ();. if (!l->locked) {. l->locked = 1;. } else {. . queue_add. (&l->q, . CV. Last lecture. Controlling interrupts. Test . and set (atomic exchange). Compare and swap. Load linked . and . store conditional. Fetch and add . and . ticket locks. typedef. . struct. __. lock_t. Slide . 1. Uniprocessor . Locks. void . lock_acquire. (. struct. lock *l) {. . intr_disable. ();. if (!l->locked) {. l->locked = 1;. } else {. . queue_add. (&l->q, . Concurrency. Threads. Locks. Condition Variables. Fixing atomicity violations and order violations. Semaphore. Semaphores . keep extra state, so users sometimes don’t. .. Unlike . CV, signal was not lost . Lecture 10 Locks Scheduling Control: Mutex /Lock Basic pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock (&lock); x = x + 1; // or whatever your critical section is Lecture 10 Locks Scheduling Control: Mutex /Lock Basic pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock (&lock); x = x + 1; // or whatever your critical section is Lecture 13 Concurrency Bugs CV rules of thumb: Keep state in addition to CV’s Always do wait/signal with lock held Whenever you acquire a lock, recheck state Implementing Join with CV void thread_exit Slide . 1. Too Much Milk With Locks. Both threads:. struct. lock l;. .... l. ock_acquire. (&l);. if (milk == 0) . {. . . buyMilk. ();. }. lock_release. (&. l);. CS 140 Lecture Notes: Locks. class Lock {. Lock() {}. int locked = 0;. . ThreadQueue. q;. };. void Lock::lock() {. . intrDisable. ();. if (!locked) {. locked = 1;. } else {. . q.add. (. currentThread. Lecture 21. April . 11. th. , . 2012. Distributed Shared Memory (. con’t. ). Synchronization. Prof John D. Kubiatowicz. http://www.cs.berkeley.edu/~kubitron/cs252. Recall: Sequential Consistency of Directory Protocols.
Download Document
Here is the link to download the presentation.
"Lecture 11 PA2 , lock, and CV"The content belongs to its owner. You may download and print it for personal use, without modification, and keep all copyright notices. By downloading, you agree to these terms.
Related Documents