4 Pages

Updates

Course: CS 570, Fall 2008
School: San Diego State
Rating:
 
 
 
 
 

Word Count: 1083

Document Preview

(Cont.) 8-31 A MESSAGES safer, more efficient and more convenient method for thread communication via bounded buffer is to implement a new higher level system object message buffer: Implementation of Message Objects API library functions: HANDLE init_message_buffer(int N); void send(HANDLE h, Slot *x); void receive(HANDLE h, Slot *x); // Create a new message object // Send message // receive message Trap...

Register Now

Unformatted Document Excerpt

Coursehero >> California >> San Diego State >> CS 570

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
(Cont.) 8-31 A MESSAGES safer, more efficient and more convenient method for thread communication via bounded buffer is to implement a new higher level system object message buffer: Implementation of Message Objects API library functions: HANDLE init_message_buffer(int N); void send(HANDLE h, Slot *x); void receive(HANDLE h, Slot *x); // Create a new message object // Send message // receive message Trap handlers: // Message type (hidden in kernel) typedef struct { int N; int in, out; int count; Slot *B; BOOL lock; QUEUE mutex; QUEUE nonfull; QUEUE nonempty; BOOL guard; } Message_buffer; SEND: // // // // // // // // // Maximal number of slots Buffer pointers Number of slost placed into buffer Pointer to the buffer space CS lock to protect access to buffer Queue of thr. waiting to access the buff. Queue of thr. waiting for non-full cond. Queue of thr. waiting for non-empty cond. To protect lock, mutex, nonfull, nonempty // prefix "p->" omitted for simplicity Disable interrupts; Get p = (Message_buffer *)h via register or stack; enter(mutex); if (count == N) wait(nonfull,mutex); enter(), wait() and B[in] = *x; in = (1+in)%N; signal() are internal kernel count++; functions, they are not called signal(nonempty,mutex); via TRAP, however they RTE; return via RTE (see next page) RECEIVE: Disable interrupts; Get p = (Message_buffer *)h via register or stack; enter(mutex); if (count == 0) wait(nonempty,mutex); *x = B[out]; out = (1+out)%N; count--; signal(nonfull,mutex); RTE; Copyright 1998, 1999 by Marko Vuskovic MESSAGES (Cont.) 8-32 enter(m): push(SR); while (tsl(guard)) {}; if (lock){ block(m); } else{ lock = TRUE; } guard = FALSE; RTE; // Save status register // To protect lock // Release spinlock wait(c,m): push(SR); while (tsl(guard)) {}; running2blocked(c); if (queue m not empty) blocked2ready(m); else lock = FALSE; ready2running; guard = FALSE; RTE; // Save status register // To protect lock // Release spinlock signal(c,m): push(SR); // Save status register while (tsl(guard)) {}; // To protect lock if( queue c not empty) unblock(c); else { if(queue m not empty) unblock(m); else lock = FALSE; } guard = FALSE; // Release spinlock RTE; Copyright 1998, 1999 by Marko Vuskovic MESSAGES (Cont.) FREQUENTLY ASKED QUESTION 8-33 Q1: Why we need to ensure mutual exclusion of buffer variables N, out, in, B[], count, lock...by using enter()? If we disable interrupts in traps SEND and RECEIVE, then no other thread can be scheduled while some thread is executing SEND or RECEIVE, therefore the mutual exclusion is already achieved. A1: That is true only for uniprocessor machines. In multiprocessor machines we must have enter(). Q2: Isn't it too dangerous to disable interrupts in SEND and RECEIVE? There is for example wait() which blocks the thread if the buffer is full/empty. The thread can be blocked until some other thread removes/puts slots from/into the buffer. A2: If a thread is blocked it doesn't mean that the execution is stuck in kernel. Blocking means updating and relinking the thread/process control blocks plus modifying the kernel stack (see pages 3-11 to 3-15). The RTE will make sure that the execution continues somewhere else without waiting for the bocking condition to be changed, i.e. that someone removes/puts a sloot from/to the buffer. Yes, Q3: but what if execution continues in kernel. That means, the interrupt is disabled during thread switching, which can be relatively long if the thread is outswapped? A3: True, this is a real danger if OS has virtual memory. Therefore Microsoft has introduced deferred procedure calls (DPC), (see chapter 12). Shortly, an interrupt service routine (ISR) has interrupts disabled only for a critical period of time, which is short enough and which doesn't cover the thread switching. Q4: Why we need to push processor status register (SR) onto kernel stack in kernel functions enter(), wait() and signal()? A4: Because these functions exit with RTE, there must be a correct balance on the kernel stack. Q5: Why do we need RTE in enter(), wait() and signal() anyway? These are functions, not traps and they are called by JSR (jump to subroutine), consequently they can exit with RTS (return from subroutine). Both, JSR and RTS push/pop only PC. A5: RTE doesn't necessarily mean that the execution will continue at the first instruction after the function call. The execution can continue in s some other thread. Essentially enter(), wait() and signal() do not follow FIFO principle, they behave more like coroutines. If the execution continues somewhere else, specially in user space, the user environment has to be restored, i.e. SR has to be restored. Copyright 1998, 1999 by Marko Vuskovic MESSAGES (Cont.) FREQUENTLY ASKED QUESTION (Cont.) Q6: Why the variable lock is not reset in than part of the outer if statement in signal()? If we are unblocking a thread we also need to make the critical section free for the unblocked thread. A6: The lock variable must be left TRUE. Consider signal(nonfull,mutex) in RECEIVE trap. 8-34 (a) Suppose that the unblocked thread (which was waiting due to a call of wait(nonfull,mutex)), gets running (unblock (nf) macro). This thread will continue execution imediately after the wait(nonfull,mutex) function call in SEND trap. Apparently, this thread won't have chance to set the lock variable, so it needs to be left TRUE. Same holds for signal(nonempty,mutex) in SEND trap. (b) Suppose now that the thread that called signal(nonfull,mutex) gets running (while the unblocked thread remains in ready queue). This thread will immediately leave the trap and return to the user space. Consequently noone is virtually in critical section and the lock variable is TRUE. That is however OK because the blocked thread will eventually get running, and we have the case (a). Q7: Why the variable lock is not reset in else part of the outer if statement in signal()? Like in Q6, we are leaving trap and critical section, therefore we need to reset the lock variable. A7: Answer is similar to A6. The only difference is that the other thread is blocked on enter(mutex) instead of wait(nonfull,mutex), and will continue execution after this call. The lock variable must therefore remain TRUE. Q8: Why do we need RTE at the end of SEND and RECEIVE traps? WE already have RTE at the end of signal(). A8: RTE in signal() and wait() exist for reason considered above. Eventually each call to SEND and RECEIVE trap will end up with PC loaded with address immediately after signal(). From there we need to return from the trap to the user space. Copyright 1998, 1999 by Marko Vuskovic
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

San Diego State - CS - 570
M.I. VuskovicOperating SystemsInterprocess CommunicationChapter 9INTERPROCESS COMMUNICATIONTable of Contents:9.1 INTRODUCTION 9.2 SHARED MEMORY 9.2.1 UNIX System V Shared Memory 9.2.2 Win32 Shared Memory 9.3 MESSAGES 9.3.1 UNIX System V M
San Diego State - CS - 570
San Diego State - CS - 570
1 of 5AN EXAMPLE OF DYNAMIC LINKING1. Implementation of the libraries/* x.cpp This library contains two mathematical functions written in C language. It can be used as statically or dynamically linked library. It can be called from both, C or C
San Diego State - CS - 570
M.I. VuskovicOperating SystemsVirtual MemoryChapter 5 VIRTUAL MEMORYTable of contents:5.1 DEMAND PAGING 5.1.1 General Principle 5.1.2 Page Fault 5.1.3 Performance of Demand Paging 5.2 PAGE REPLACEMENT 5.2.1 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7
San Diego State - CS - 570
Page 1 of 7CS 570HOUR TEST #2May 6, 2002Name (Last, First):_SSN:_ ROW: _ COL: _ IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY. ILLEGIBLE ANSWERS WILL NOT BE GRADED. This is a closed-book exam. Only a half letter-size page cheat-sheet is allowed.
San Diego State - CS - 570
Page 1 0f 6CS 570HOUR TEST #1March 28, 2001Name (Last, First):_SSN:_ ROW: _ COL: _ IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY. ILLEGIBLE ANSWERS WILL NOT BE GRADED.This is a closed-book exam. Only a half letter-size page cheat-sheet is allo
San Diego State - CS - 570
C:\Documents and Settings\Administrator>cmd /? Starts a new instance of the Windows 2000 command interpreter CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [/S] [/C | /K] string] /C /K /S /Q /D /A /U Carries out the comman
San Diego State - CS - 656
1TRIGONOMETRY (Most Frequent Formulas Used in Robotics)11.1Some Trigonometric IdentitiesNotation used in robotics: cos( i ) = ci sin( i ) = si Identities: cos( i + sin( i +j) j)= cij = sijcos( i + sin( i +j j+ +k) k)= cijk = si
San Diego State - CS - 556
San Diego State - CS - 556
San Diego State - CS - 556
San Diego State - CS - 656
Page 1 of 6CS 656 (Robotics)HOUR TEST #1SampleName (Last, First): _ SSN: _ This is an open-book exam. You may use any material, excluding the quiz papers or their transcriptionsFill-in the following table: 1. Prove the identity rot (b, ) b
San Diego State - CS - 656
Study Questions (CS656)1 of 3Study QuestionsFor test #2 in Advanced Robotics (cs656) May 20061. Given is a robot environment (picture). (a) Determine relative homogeneous matrices for the following objects in the environment. (b) Determine the
San Diego State - CS - 656
1 of 9THIS ARE SAMPLESCS 656 (Robotics) HOUR TEST #2 May, 2006IMPORTANT: This is an open-book exam. Books and Lecture notes are permitted. Examples are not permitted.1. Given is a 3 DOF ceiling robot in home configuration as shown below. Suppo
San Diego State - CS - 656
San Diego State - CS - 656
1Dierential Kinematics and Statics11.1Manipulator Velocitieszi z2q2v22viiznv1z11.vnnq1z0veezeA manipulator is a serial chain of links connected through joints. If the joints move at rate qi (called the joint
San Diego State - CS - 656
1LINEAR ALGEBRA (Review of Basic Concepts Used in Robotics)11.1MatricesA = [aij ]m A = [aij ]n = [aij ]n [aij ]m = [bij ]m [aij ]m + [bij ]m = [aij + bij ]m [aij ]m = [ aij ]m [aij ]mn T n n n n n n n n nD-1.2 D-1.2 D-1.3 D-1.4 D-1.5 D-1.
San Diego State - CS - 656
1Mathematical Preliminary11.11.1.1Rotation of Vectors in Physical SpaceRodrigues'FormulaC m n k a b OProblem: Given is an arbitrary 3 1 vector a, a unit vector k; (jkj = 1) ; and an angle ': Find the victor b which is the result of rotat
San Diego State - CS - 656
1Manipulator Kinematics11.1Standard FramesWrist (W) Tool (T) Goal (G) Station (S)Manipulator Base (B)B STB WSS GTW TG TBWTTThere are several important frames relevant to robot kinematics: {B} {S} {W} {T} {G} Base F
San Diego State - CS - 570
M.I. VuskovicOperating SystemsThread SynchronizationChapter 6 THREAD SYNCHRONIZATIONTable of contents:6.1 INTRODUCTION 6.1.1 Critical Section 6.1.2 Mutual Exclusion 6.1.3 Producer-Consumer Relation 6.1.4 Thread Synchronization 6.1.5 Bounded B
San Diego State - CS - 4
CS570 Programming Assignment #4 TURTLES ARE BACK!Operating SystemsSpring 2004Assigned: March 22; Due: April 5If you survive this assignment, you will have a very good idea about threads and their synchronization with critical sections, semaph
San Diego State - CS - 570
CS570 Programming Assignment #4 TURTLES ARE BACK!Operating SystemsSpring 2004Assigned: March 22; Due: April 5If you survive this assignment, you will have a very good idea about threads and their synchronization with critical sections, semaph
San Diego State - CS - 5
Page 1 of 5CS570 Programming Assignment #5Operating SystemsSpring 2004Assigned: April 12; Due: April 26The goal of this assignment is to learn and to get some experience about Interprocess Communication (IPC) by using the two most common an
San Diego State - CS - 570
Page 1 of 5CS570 Programming Assignment #5Operating SystemsSpring 2004Assigned: April 12; Due: April 26The goal of this assignment is to learn and to get some experience about Interprocess Communication (IPC) by using the two most common an
San Diego State - CS - 570
M.I. VuskovicOperating SystemsIntroductionChapter 1INTRODUCTIONTable of Contents:1.1 WHAT IS OPERATING SYSTEM? 1.1.1 I/O Management 1.1.2 Processor(s) Management 1.1.3 Memory Management 1.1.4 Virtual Memory 1.1.5 Synchronization and Commu
San Diego State - CS - 570
M.I. VuskovicOperating SystemsMemory ManagementChapter 4MEMORY MANAGEMENTTable of contents:4.1 Fixed-Size Partitioning 4.2 Dynamic Partitioning 4.3 Paging 4.4 Multi-Level Paging 4.5 Inverted Page Tables 4.6 Segmentation 4.7 Segmentation wi
San Diego State - CS - 570
M.I. VuskovicOperating SystemsFile SystemChapter 8 FILE SYSTEMTable of contents:8.1 INTRODUCTION 8.2 FILE ALLOCATION 8.2.1 Contiguous Allocation 8.2.2 Linked Allocation 8.2.3 8.2.4 8.2.5 8.2.6 8.2.7 Indexed Allocation Multilevel Indexed Allo
San Diego State - CS - 570
M.I. VuskovicOperating SystemsProgramChapter 2PROGRAMTable of Contents:2.1MONOLITIC PROGRAMS 2.1.1 Static Linking 2.1.2 Loading 2.1.3 Execution Environment of a Program2-3 2-4 2-62.2MODULAR PROGRAMS 2.2.1 Dynamic Linking (general)
San Diego State - CS - 570
M.I. VuskovicOperating SystemsProcesses and ThreadsChapter 3PROCESSES AND THREADS3.1 EVOLUTION OF OPERATING SYSTEMS 3.2 PROCESSES 3.2.2 Structure of a Process 3.2.3 Process States 3.2.4 Process Control Block (PCB) 3.2.5 Process Queues 3.2.6
San Diego State - CS - 570
Page 1 of 4CS 570HOUR TEST #2May 16, 2001Name (Last, First):_SSN:_ ROW: _ COL: _ IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY. ILLEGIBLE ANSWERS WILL NOT BE GRADED. This is a closed-book exam. Only a half letter-size page cheat-sheet is allowed
San Diego State - CS - 570
1 of 4CS 570HOUR TEST #2July 12, 2001Name (Last, First):_SSN:_ ROW: _ COL: _ IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY. ILLEGIBLE ANSWERS WILL NOT BE GRADED.This is a closed-book exam. Only a half letter-size page cheat-sheet is allowed. (
San Diego State - CS - 570
Program Grading SheetProgramming Assignment No. _ Name: _CS 570, Spring 2004masc00__ Sources dont compile or don't link (-100pt) _ Turned in late (-20pt per working day) _ Lack of, or poorly updated banner (-1pt to 5pt) _ Lack of, or too poor
San Diego State - CS - 570
CS570: Operating Systems Spring 2004Instructor: Office: Office Hours: Lectures: Prerequisites: Marko Vuskovic (marko@cs.sdsu.edu) GMCS-547, 594-4302; Lab: GMCS-408, 594-7894 MW 17:30-19:00; MW 16:00-17:15, BAM 347 CS310 (Data Structures), CS370 (Com
San Diego State - CS - 570
Strings.docPage 1 of 3SOME COMMENTS ABOUT STRINGS IN C/C+ 1. There is no string assignment in Cchar text[80]; char s[10]; text = s; / / / / IS ILLEGAL names "text" and "s" are just array names or CONSTANT pointers to array of characters (You can
San Diego State - CS - 570
STUDY QUESTIONS FOR COURSE CS570 (OPERATING SYSTEMS)(Chapter 1 is missing intentionally.)Chapter 2: Program1. Explain the following terms: (a) Object module (b) Load module (c) Image of the load module 2. Dynamic linking (a) What is the differenc
San Diego State - CS - 570
Page 1 of 6CS 570HOUR TEST #1_June 22, 2001Name (Last, First):_SSN (4 digits):_ ROW: _ COL: _ IMPORTANT: PLEASE WRITE NEATLY AND LEGIBLY. ILLEGIBLE ANSWERS WILL NOT BE GRADED.This is a closed-book exam. Only a half letter-size page cheat-
San Diego State - CS - 596
IGMP-1Chapter 10Internet Group Management Protocol (IGMP)McGraw-Hill The McGraw-Hill Companies, Inc., 2000IGMP-2IGMP v2: RFC 2236, Xerox, November 1997 IGMP v1: RFC 1112, Stanford University, August 1989IGMP is used by IP hosts to register
San Diego State - CS - 576
S-1Supplementary MaterialSockets(Excerpt from the chapter about inter process communication, Operating Systems (CS570) NOTICE: This material should be discussed after the chapter 12 (TCP). However, due to an early programming assignment which us
San Diego State - CS - 576
Chapter 1111-1User Datagram Protocol (UDP)McGraw-Hill The McGraw-Hill Companies, Inc., 200011-2Position of UDP in the TCP/IP protocol suiteMcGraw-HillThe McGraw-Hill Companies, Inc., 200011-3UDP versus IPUDP is connectionless, unre
San Diego State - CS - 576
20-1Chapter 20File Transfer Protocol (FTP)McGraw-Hill The McGraw-Hill Companies, Inc., 200020-2RFC 114, April 1971, MAC Project, MIT first specification RFC 959, October 1997, ISI (Information Science Institute), USC last revision RFC 2228
San Diego State - EDTEC - 644
Department of Educational Technology College of Education SAN DIEGO STATE UNIVERSITY Individual Response to Group Process Purpose of the Form One of your responsibilities for this course is an honest statement of your contributions and the contributi
San Diego State - PROP - 227
What the SAT-9 Really Says About Latino Student Achievement LULAC Convention Los Angeles, CA May 18,2002Jill Kerper Mora, Ed.D. San Diego State UniversityCalifornia's Demographic Reality 38% of California's total population speaks a language othe
San Diego State - GB - 9900
General Requirements for Doctoral DegreesDoctoral programs at San Diego State University are offered jointly with other doctoral-granting institutions in California. In developing each program, there has been a consistent effort to provide students
NYU - POLITICS - 4740
Transitional Economic Voting: Economic Conditions and Election Results in Russia, Poland, Hungary, Slovakia, and the Czech Republic from 1990-1999Joshua A. Tucker Assistant Professor of Politics and International Affairs Princeton University Visiti
NYU - W - 2006
Macroeconomic Conditions, Firm Characteristics, and Credit SpreadsDragon Yongjun Tang March 15, 2005First version: April 10, 2004ABSTRACT We study a structural model that allows us to examine how credit spreads are affected by the interaction of m
NYU - W - 2008
OutlineSummary of the paperThe Credit Spread puzzleThe Capital Structure PuzzleAre Both Puzzles Linked?CommentsDiscussion of Macroeconomic Conditions and the Puzzles of Credit Spreads and Capital Structure by Hui ChenPierre Collin-Dufres
NYU - W - 2008
Macroeconomic Conditions, Corporate Financing Decisions, and Credit RiskHui ChenMIT SloanMay 14, 2008SummaryThe Puzzles"credit spread puzzle"10-year Baa-Treasury 10-year Baa-Aaa data 148 bp 101 bp existing models 3965 bp 3352 bpSummaryT
NYU - W - 2008
Will Recovery Rates Be Unusually Low in this Default Cycle?Kenneth Emery Director of Corporate Default ResearchMay 2008Introduction/AgendaLoans historically a high recovery asset class But in last few years, increasing use of loans in rated is
NYU - W - 2008
Liquidity, Securitization, and PolicyTil Schuermann* Federal Reserve Bank of New YorkMoodys / NYU-Stern 5th Annual Credit Risk Conference New York, May 14, 2008* Any views expressed represent those of the author only and not necessarily those of
NYU - W - 2006
Market Transparency, Liquidity Externalities, And Institutional Trading Costs in Corporate Bonds*Hendrik Bessembinder, University of Utah* William Maxwell, University of Arizona Kumar Venkataraman, Southern Methodist UniversityInitial Draft: Novemb
NYU - DD - 16
Optimized interface conditions for the compressible Euler equationsVictorita Dolean1 and Frdric Nataf2 e e1 2UMR 6621 CNRS, Universit de Nice Sophia-Antipolis dolean@math.unice.fr e CMAP, UMR 7641 CNRS, Ecole Polytechnique nataf@cmap.polytechniq
NYU - DD - 16
Adaptive Coarse Space Selection in the BDDC and the FETI-DP Iterative Substructuring Methods: Optimal Face Degrees of FreedomJan Mandel1 and Bedich Soused 2 r ik12Department of Mathematics, University of Colorado at Denver, P.O. Box 173364, Cam
NYU - DD - 16
Uniform Convergence of a Multilevel Energy-based Quantization SchemeMaria Emelianenko 1 and Qiang Du 1Pennsylvania State University, University Park, PA 16803 emeliane@math.psu.edu and qdu@math.psu.eduAbstract Quantization has diverse application
NYU - DD - 16
Optimized Schwarz Methods with Robin Conditions for the Advection-Diusion EquationOlivier DuboisMcGill University, Department of Mathematics & Statistics, 805 Sherbrooke, W Montreal, Quebec, H3A 2K6, Canada. dubois@math.mcgill.ca Summary. We study
NYU - DD - 16
Nonconforming methods for nonlinear elasticity problemsBernd Flemisch and Barbara I. WohlmuthUniversity of Stuttgart, Institute for Applied Analysis and Numerical Simulation {flemisch,wohlmuth}@ians.uni-stuttgart.deSummary. Domain decomposition m
NYU - DD - 16
Condition Number Estimates for C 0 Interior Penalty MethodsShuang Li1 and Kening Wang212Department of Mathematics, University of South Carolina, Columbia, SC 29208 sli@math.sc.edu Department of Mathematics, University of South Carolina, Columbi
NYU - DD - 16
Domain Decomposition for Heterogeneous MediaIvan G. Graham1 and Patrick O. Lechner212Department of Mathematical Sciences, University of Bath, Bath, BA2 7AY, United Kingdom, igg@maths.bath.ac.uk, Department of Mathematical Sciences, University o
NYU - DD - 16
Domain-decomposed Fully Coupled Implicit Methods for a Magnetohydrodynamics ProblemSerguei Ovtchinnikov1 , Florin Dobrian2 , Xiao-Chuan Cai3 , David Keyes41234University of Colorado at Boulder, Department of Computer Science, 430 UCB, Bould
NYU - DD - 16
Overlapping Schwarz preconditioners for Fekete spectral elementsR. Pasquetti1 , L. F. Pavarino2, F. Rapetti1 , and E. Zampieri212Laboratoire J.-A. Dieudonn, CNRS & Universit de Nice et Sophia-Antipolis, e e Parc Valrose, 06108 Nice cedex 02, Fr
NYU - DD - 16
Preconditioning of Saddle Point Systems by Substructuring and a Penalty ApproachClark R. Dohrmann1Sandia National Laboratories, crdohrm@sandia.gov. Sandia is a multiprogram laboratory operated by Sandia Corporation, a Lockheed Martin Company, for t
NYU - DD - 16
Spectral element agglomerate AMGeT. Chartier1 , R. Falgout2 , V. E. Henson2 , J. E. Jones4 , P. S. Vassilevski2 , T. A. Manteuel3 , S. F. McCormick3 , and J. W. Ruge31234Department of Mathematics, Davidson College, P.O. Box 6908, Davidson,