Xem mẫu

PROPRIETARY MATERIAL. © 2007 The McGraw­Hill Companies, Inc. All rights reserved. No part of this PowerPoint slide may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw­Hill for their individual course preparation. If you are a student using this PowerPoint slide, you are using it without permission. Process Synchronization Dhamdhere: Operating Systems— Copyright © 2008 Process Synchronization • Processes that work toward a common goal must coordinate their activities – Such coordination is achieved through synchronization – We discuss two kinds of synchronization defined in Chapter 3 * Data access synchronization Avoiding race conditions through mutual exclusion * Control synchronization Ensuring that processes perform their actions in a desired order Process Synchronization Dhamdhere: Operating Systems— Copyright © 2008 Interacting processes • Definition: – Processes Pi, Pj are interacting processes if read_seti ∩ write_setj ≠ Ø or write_seti ∩ read_setj ≠ Ø, where * Read-set : Set of variables merely read by a process * Write-set : Set of variables read and written to by a process – Non-interacting processes are independent processes Process Synchronization Dhamdhere: Operating Systems— Copyright © 2008 Critical Section (CS) • Definition – A critical section (CS) for a data item ds is a section of code that cannot be executed concurrently with itself or with another critical section for ds * We will use a dashed rectangular box to indicate a critical section in a code segment (see next slide) • Data access synchronization – Is defined as ensuring an absence of race conditions over a shared data item ds * It is achieved by enclosing all uses of ds within critical sections Process Synchronization Dhamdhere: Operating Systems— Copyright © 2008 A process having critical sections We assume a process to consist of a single infinite loop; a dashed rectangular box depicts a critical section (a) A process having many critical sections (b) A process having a single critical section Process Synchronization Dhamdhere: Operating Systems— Copyright © 2008 ... - tailieumienphi.vn
nguon tai.lieu . vn