11 Pages

l2-2

Course: CS 422, Fall 2009
School: Yale
Rating:
 
 
 
 
 

Word Count: 988

Document Preview

Krishnamurthy Concurrency Arvind Spring 2004 Todays lecture n Semester roughly divided into: n n n n Threads, synchronization, scheduling Virtual memory File systems Networking n Next 2.5 weeks: threads and synchronization Today: thread basics Friday: C++ tutorial Wednesday: thread implementation n n n 1 Process Environments n Uniprogramming: 1 process at a time n n n n Cooperative timesharing: mostly...

Register Now

Unformatted Document Excerpt

Coursehero >> Connecticut >> Yale >> CS 422

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.
Krishnamurthy Concurrency Arvind Spring 2004 Todays lecture n Semester roughly divided into: n n n n Threads, synchronization, scheduling Virtual memory File systems Networking n Next 2.5 weeks: threads and synchronization Today: thread basics Friday: C++ tutorial Wednesday: thread implementation n n n 1 Process Environments n Uniprogramming: 1 process at a time n n n n Cooperative timesharing: mostly PCs, vintage OSes Easy for OS, hard for user (generally) Does not deal with concurrency (by defining it away) Violates isolation: Infinite loops OS n Multiprogramming: > 1 process at a time n Time-sharing: CTSS, Multics, Unix, VMS, NT, ... OS Why concurrency? n Operating systems have two general functions: A. Standard services: Provide standard facilities that everyone needs Examples: standard libraries, file systems, windowing systems B. Coordinator: allow several things to work together Examples: memory protection, virtual memory n OS has to coordinate all the activity on a machine n Requests from multiple users, I/O interrupts Instead of dealing with everything at once, deal with one at a time n Decompose hard problems into simpler ones n 2 Processes n Process: OS abstraction to represent what is needed to run a single program Formally, a process is a sequential stream of execution in its own address space Two parts to a process: n n n n Sequential execution: no concurrency inside a process everything happens sequentially Process state: everything that is necessary to run the process n Question: What is typically part of the process state? n In other words, suppose you want to migrate a process what would you have to transport to the new machine? Program vs. process main() { ... foo() ... } foo() { ... } main() { ... foo() ... } foo() { ... } heap stack main foo registers PC Process Program 3 Program vs. process (contd) n Process > program n n Program is just part of process state Example: many users can run the same program (creating different processes) n Process < program n n A program can invoke more than one process Example: cc starts up cpp, cc1, cc2, as, ld (each are programs themselves) Process creation in Unix n Each process has its own state Even if two processes are created from the same executable, they will still have different state associated with them When a process clones itself using fork, a separate copy is created n n int x = 1; int pid; main() { pid = fork(); x = x + 1; } Updates made on different variables 4 Process creation in Unix (contd.) n How to make processes: n n fork clones a process exec overlays the current process if((pid = fork()) == 0) { /* child process */ exec(foo); else /* parent */ wait(pid); /* exec does not return */ /* wait for child to finish */ n Question: Is this a good interface? Announcements n Zheng Ma is the TA for the class n n Email: zheng.ma@yale.edu Please put cs422 in subject line n Assignment 0 is on the class website n n Each person needs to this separately Due: Jan 26th 5 Processes, Threads, Address Spaces n Process: Thread(s) + Address space Thread: sequential execution stream within a process n n Provides concurrency n Address space: state needed to run a program n context n n Execution or Container for execution stream Literally, all the memory addresses that can be touched by the program Provides illusion of program having its own machine n Multithreading: single program composed of a number of different concurrent activities Thread creation in Nachos n Thread creation in Nachos is very explicit void SimpleThread (int which) { int num; for (num=0; num<5; num++) printf(*** thread %d looped %d times\n, which, num); } void ThreadTest() { Thread *t = new Thread(forked thread); t->Fork(SimpleThread, 1); SimpleThread(0); } n What is the output? Depends on the implementation 6 Explicit Yields void SimpleThread (int which) { int num; for (num=0; num<5; num++) { printf(*** thread %d looped %d times\n, which, num); currentThread->Yield(); } } void ThreadTest() { Thread *t = new Thread(forked thread); t->Fork(SimpleThread, 1); SimpleThread(0); } Thread State n Can be classified into two types: n n Private Shared n Shared state n n Contents of memory (global variables, heap) File system n Private state n n n Program counter Registers Stack 7 Threads Share Memory int done[2] = {0, 0}; void SimpleThread (int which) { int num; for (num=0; num<5; num++) printf(*** thread %d looped %d times\n, which, num); done[which] = 1; } void ThreadTest() { Thread *t = new Thread(forked thread); t->Fork(SimpleThread, 1); SimpleThread(0); while (!done[1]); // Perform work that incorporates results from two threads } Classifying State int x; void foo() { int y; x = 1; y = 1; } global variable stack variable main() { int *p; p = (int *)malloc(sizeof(int)); *p = 1; heap access } 8 Address Space Properties n n Addresses of global variables defined at link-time Addresses of heap variables defined at malloc-time int x; main() { int *p = malloc(sizeof(int)); printf(%x %x, &x, p); } // &x will never change across executions, p might Stack Variables ...

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:

University of Illinois, Urbana Champaign - PHYS - 102
Physics 102F = maHour Exam 1 Formula Sheet Energy = 1 1 q2 qV = CV 2 = 2 2 2CSpring 2006F=kq1q2 r21 4 01 Energy density = 0 E 2 2CP = C1 + C2 + .k=k = 8.99 109 Nm 2 / C 2 0 = 8.85 10-12 C 2 / Nm 2e = 1.60 10-19 C E= F q0 kq r2 q
University of Illinois, Urbana Champaign - PHYS - 102
Physics 102: Lecture 04Capacitors! Today's lecture will cover Textbook Sections 17.5-6, 18.1-2, 6Physics 102: Lecture 4, Slide 1Capacitance: The ability to store separated charge C=Q/VCharge Q on plates V = VA VB = +E0 d+ + +A + + d E=E 0 B
ETSU - TSTS - 4717
Points missed: _ Total score: _ /100 pointsStudent's Name: _East Tennessee State University Department of Computer and Information Sciences CSCI 4717 Computer Architecture TEST 3 for Fall Semester, 2006Read this before starting! The total poss
University of Illinois, Urbana Champaign - CS - 598
CS 598SS Lecture 4Saurabh SinhaEvolution and Tree of lifePhylogenetic treeTree of lifePhylogenetic tree2 10 2 10 2 2 Species 1 Species 2 Species 3 Species 4Branch lengths = &quot;divergence&quot;Phylogenetic tree Early methods: fossil evidence, m
University of Illinois, Urbana Champaign - CS - 373
CS 373: Theory of ComputationManoj Prabhakaran Mahesh Viswanathan Fall 20081Regular Expressions and Regular Languages Why do they have such similar names? Theorem 1. L is a regular language if and only if there is a regular expression R such tha
Yale - GEOLOGY - 1960
University of Illinois, Urbana Champaign - BA - 374
BA374 Exam 3 answers (8:30 section) 1 (B). Large change, U L = 11047 + 200 is &quot;red light.&quot; 2 (A). Large change, U L = 11047 + 250 not helpful, LL = 11047 + 247.5 is &quot;green light.&quot; 3 (C). Large change, U L = 11047 - 555 not helpful, no LL. 4 (A). (15/
Yale - GEOLOGY - 1975
ETSU - TSTS - 2150
Points missed: _Student's Name: _Total score: _ /100 points East Tennessee State University Department of Computer and Information Sciences CSCI 2150 (Tarnoff) Computer Organization TEST 2 for Spring Semester, 2009Read this before starting!
Yale - DM - 324
THE INFLUENCE OF SOCIAL NETWORKSON THE EFFECTIVENESS OF PROMOTIONAL STRATEGIES*Dina Mayzlin Yale UniversityJuly 17, 2002This is a preliminary draft. Please do not quote without the authors permission. I am grateful to David Godes and Guido Ku
University of Illinois, Urbana Champaign - ED - 590
Copy Room Caper Chemistry Final Apollo 2005 Station 1: Qualitative Analysis (8 points) Identify the substances. The number behind each letter indicates the number of substances it contains. A (1) _ B (1) _ C (2) _ _(This powder is evidence)Name_R
Yale - FINAID - 0809
*Because of federal legislation that reduced federal subsidies to lenders - not to mention the lack of liquidity in the student loan market- lenders are changing borrower benefits with little notice. Therefore, assume all borrower benefits are subjec
Yale - FINAID - 0809
*Due to the lack of liquidity in the student loan market, lenders are changing borrower benefits with little notice. Therefore, assume all borrowers benefits are subject to change without notice. When changes are communicated to us, we will update th
University of Louisville - PHS - 2590
GRANT NUMBER:BIOGRAPHICAL SKETCHGive the following information for all new key personnel. Copy this page for each person. NAME POSITION TITLEEDUCATION/TRAINING (Begin with baccalaureate or other initial professional education, such as nursing. I
University of Illinois, Urbana Champaign - MATH - 220
First Time Registration1.Student QuickStart Guide - MathZoneGo to www.mathzone.com and from the dropdown menu, choose the book you are using in your course. 2. Click on the link Don't have a Username? Register now by following this link. 3. Clic
ETSU - MATH - 1530
Probability and Statistics (MATH 1530-017) Attendance Quiz, April 7, 2009NAME E-NUMBERPick the letter of the best answer. The problems are worth 2 points each. 1. The number of hours a light bulb burns before failing varies from bulb to bulb. The
University of Illinois, Urbana Champaign - CS - 579
Non-Uniform ComputationLecture 10 Non-Uniform Computational Models: Circuits1Non-Uniform Computation2Non-Uniform ComputationUniform: Same program for all (the infinitely many) inputs2Non-Uniform ComputationUniform: Same program for all
University of Illinois, Urbana Champaign - CS - 433
Chapter 6: MultiprocessorsIntroduction (Section 6.1) What is a parallel or multiprocessor system? Why parallel architecture? Performance potential Flynn classification Communication models (Section 6.1) Architectures (Section 6.1) Centralized shared
University of Illinois, Urbana Champaign - MATH - 461
NAME:Math 461 Fall 2008 Test 2Total points: 100. Do all questions. Explain all answers. No notes, books, or electronic devices. You can use any formula for density or expectation given in class without a proof.x | 0.00 0.01 0.02 0.03 0.04 0.05 0.
Auburn - MNGT - 3070
Programming Logic and DesignFourth Edition, IntroductoryChapter 6 LoopingObjectives Understand the advantages of looping Control a while loop using a loop control variable Increment a counter to control a loop Loop with a variable sentinel
Yale - DM - 324
Firm-Created Word-of-Mouth Communication: Evidence from a Field TestDavid Godes and Dina Mayzlin February 2008The authors would like to thank participants at the INFORMS Annual Meeting, marketing seminars at BostonUniversity, Washington Univer
Yale - DM - 324
Firm-Created Word-of-Mouth Communication: Evidence from a Field TestDavid Godes and Dina Mayzlin August 2007The authors would like to thank participants at the INFORMS 2003 Annual Meeting in Atlanta, marketingseminars at Boston University, Was
Auburn - BUS - 271
BUS-271 FORMULA SHEETS (X4)[Updated 03/09/2009] Sven Thommesen 2009CHAPTER 12 FORMULAS PEARSON CORRELATION:rxy =sxy sx s yOLS REGRESSION PARAMETERS:b1 = ( x - x )( y - y ) (x - x )i i 2 ib0 = y - b1 xSTATISTICAL QUALITY OF THE MO
Yale - CHEM - 125
Chem 125 Lecture 62 3/30/08 Projected materialThis material is for the exclusive use of Chem 125 students at Yale and may not be copied or distributed further. It is not readily understood without reference to notes from the lecture.The Jewel in t
Auburn - CSE - 360
*fig3_44.txt*/* 1*/template &lt;class Element_Type&gt;/* 2*/inline void/* 3*/Stack&lt;Element_Type&gt;:/* 4*/Pop( )/* 5*/{/* 6*/ Node *P;/* 7*/ if( Is_Empty( ) )/* 8*/ Error( &quot;Empty stack&quot; );/* 9*/ else/*10*/ {/*11*/
Auburn - CSE - 360
*fig4_6.txt*/* 1*/void/* 2*/List_Directory( const Directory_Or_File &amp; D, const int Depth = 0 )/* 3*/{/* 4*/ if( Is_A_Legitimate_Entry( D ) )/* 5*/ {/* 6*/ Print_Name( Depth, D );/* 7*/ if( Is_Directory( D ) )/* 8*
Auburn - CSE - 360
Sheet1 *fig10_66.txt* /* 1*/ / Supporting types. /* 2*/enum Value_Type { Comp_Loss, Draw, Comp_Win } /* 3*/enum Player_Type { Comp, Human } /* 4*/typedef int Board_Type[ 10 ] /* 5*/ / Supporting routines. /* 6*/int Full_Board( Board_Type B ) /* 7*/in
Auburn - BIOL - 1030
Basic Principles of Animal Form and FunctionCh. 40Physical Laws and Animal Form Physical laws limit the evolution of animal formTunaSharkPenguinDolphinSealExchange with the Environment Cells must be in aqueous mediumDiffusionGastr
Auburn - BIOL - 6140
Ch. 7: Plant Growth and ReproductionPollination syndromes Pollination Syndrome: sets of traits of flowers and pollinators that adaptthem to each another Bee pollination Bees are: intelligent, agile visual animals: good eyesight (incl
Auburn - HIST - 0509
EXCRETORY (URINARY) SYSTEMI. Urinary system General information A. Kidneys semetrically paired organs that form the urine. B. Ureters carry urine to bladder, one from each kidney. C. Bladder site where urine is collected and stored until ur
Yale - MP - 364
PERSPECTIVESprosocial behavior. The absence of these kinds of leveling mechanisms in primate groups may explain why human societies differ from those of other primates. Make no mistake. This is not a group selection hypothesis that competes with kin
Yale - GEOLOGY - 1973
Yale - GEOLOGY - 1973
Yale - SR - 010
Yale - SR - 009
Yale - SR - 004
Yale - GEOLOGY - 1988
Maine - ELE - 467
Optoelectronic Device and Fiber Link Characterization in Computer Integrated Electronics LaboratoryM.G. Guvench University of Southern Maine, Gorham, ME 04038guvench@usm.maine.eduAbstractThis paper describes how automated measurement capabilitie
Maine - MBA - 675
A Guide to Business Decision-Making Using Visual SLAM II and AweSimFor use with MBA675Jack Jensen, Ph.D. 1999Introduction to Computer Simulation and the Simulation ProcessObjectives of Chapter OneUnderstand the purpose and nature of discret
Auburn - EE - 2220
EE2220Spring 2009Computer SystemsHomework # 1 (due on 1/23/09 in class) You are to show how you get the final answer for each problem. 1. Convert the following unsigned octal numbers into hexadecimal. (a) 5432 (b) 61 2. Convert the following dec
Yale - CHEM - 225
AromaticityCoal as a Source of Benzene 1675 - Bituminous coal is distilled to form tarsCoal1000 oCgas + liquid + tarilluminating gas H2 + CH4light oil 3.2 gal/ton 60% benzenetar pitch asphaltFaraday Isolates Bicarburetted Hydrogen 182
Yale - CHEM - 225
The Evolution of Formulas and Structure in Organic Chemistry During the 19th CenturyDaltons Symbols (1803)Hydrogen CarbonOxygenNitrogenJohn Dalton (1766-1844)circles for atoms of elements occasional use of letters G - gold must learn the s
Yale - CHEM - 225
Exam1-003/28/08 3:50 PMEXAM 2 CHEMISTRY 125b Friday, March 28, 2008 NAME (print): _ TA:_ Day:_ Time:_Take a few moments to look over the exam. Answer each question on the exam paper. Important clues, points, and structures are in bold. Do all p
Yale - CHEM - 225
EXAM 3 CHEMISTRY 125b Friday, April 25, 2008 NAME (print): _ TA:_ Day:_ Time:_Take a few moments to look over the exam. Answer each question on the exam paper. Important clues, points, and structures are in bold. Do all preliminary drawing or compu
Yale - CHEM - 225
EXAM 1 Freshman Organic Chemistry CHEMISTRY 125 Friday, February 15, 2008 NAME (print clearly): _ TA:_ Sect. Day:_ Sect. Time:_Take a few moments to look over the exam. Answer each question on the exam paper. No calculators, texts, notes, or laptop
Yale - CHEM - 225
PS32/4/08 4:33 PMChem 125b Problem Set 6 Chapter 16-17, Aromaticity, Electrocyclization Due: Monday, March 24, 2008Aromaticity Michael Faraday, who like Pasteur, found his fame in other areas of science, nonetheless made an important contributi
Yale - CHEM - 225
PS-12/1/08 2:29 PMChem 125b - Freshman Organic Chemistry Problem Set 2 Chapters 7 and 8, Alkenes Due: Monday, February 4, 2008Ozone In 1840 Schnbein discovered ozone (Gr.; odorant), the sharp odor produced by electrical discharges. Seven years
Yale - CHEM - 225
PS93/26/08 8:50 AMChem 125b Problem Set 9 Chapters 20 &amp; 21 Carboxylic Acids and Their Derivatives Due: Monday, April 21, 2008 The mold was hard to find and the fermentation process was inefficient. These problems were solved at the US Department
Yale - CHEM - 225
PS73/26/08 8:45 AMChem 125b Problem Set 7 Chapter 18, Aldehydes and Ketones Due: Monday, April 7, 2008 While aromatic aldehydes and ketones have generally pleasant odors, aliphatic aldehydes are pungent and often unpleasant. Aliphatic, terpene-de
Yale - CHEM - 225
PS83/26/08 8:47 AMChem 125b Problem Set 8 Chapter 19 Amines Due: Monday, April 14, 2008Papaver somniferum Cinchona Tree (source of quinine 1) Do the exercises in the Amine and Nitrile modules of ORGO. (Source of morphine 2)file:/Users/fziegle
Yale - CHEM - 225
PS3-S08-125b.html1/10/08 11:35 AMChem 125b - Freshman Organic Chemistry Problem Set 3 Chapter 9, Alkynes Due: Monday, February 11, 2008Connections Aluminum was once a precious metal although it was plentiful. The problem was how to remove it fr
Yale - CHEM - 225
PS23/1/08 9:09 AMChem 125b Problem Set 5 Chapter 15 Due: Monday, March 3, 2008See Pericyclic Reactions in the StudyAids for a review on conjugation, cycloadditions, and electrocyclic reactions. Electrocyclic reactions are not covered in the tex
Yale - CHEM - 225
PS104/30/08 1:04 PMChem 125b Problem Set 10, Chapter 22 Enols and Enolate Ions Due: Monday, April 28, 2008Charles Adolphe Wurtz (1817 - 1884) &quot;Chemistry is a French science. It was founded by Lavoisier of immortal memory.&quot; 1869 Wurtz conducted
Yale - CHEM - 225
PS-112/19/07 11:27 AMChem 125b - Freshman Organic Chemistry Problem Set 1 Chapter 6, Alkyl Halides Due: Monday, January 28, 2008 Study #2 and #3 in the Alkyl Halide module and #1 in the Ether module in ORGO.Paul Walden (1863-1957) here also 1.
University of Illinois, Urbana Champaign - CS - 273
Title:Jan3010:55AM(1of17)Title:Jan3011:04AM(2of17)Title:Jan3011:07AM(3of17)Title:Jan3011:19AM(4of17)Title:Jan3011:22AM(5of17)Title:Jan3011:24AM(6of17)Title:Jan3011:30AM(7of17)Title:Jan3011:34AM(8of17)Title:Jan3011:41AM(9of17)Title:J
Yale - CHEM - 225
PS72/20/08 8:26 AMChem 225b - Comprehensive Organic Chemistry Problem Set 7 Chapter 8, Reactions of Alkenes Due: Monday, March 24, 2008Reading assignments: a)The alkene module in ORGO. b) Ozonolysis module. How do I approach solving problems li
Yale - CHEM - 225
PS42/27/08 9:09 AM, Chem 225b - Comprehensive Organic Chemistry Problem Set 6 Chapter 7, Structure and Synthesis of Alkenes Due: Monday, March 3, 2008 1. Read Degree (Elements) of Unsaturation. How many degrees of unsaturation are present in C 8H
Yale - CHEM - 225
PS103/28/08 3:19 PMChem 225b - Comprehensive Organic Chemistry Problem Set 10 Chapter 14 - Ethers and Epoxides Due: Monday, April 28, 2008Potassium cation solvated by the cyclic polyether, 18-crown-6 [18-membered ring; 6 oxygen atoms]. Each of
Yale - CHEM - 225
PS93/28/08 8:15 AMChem 225b - Comprehensive Organic Chemistry Problem Set 9 Chapters 9 and 10, Alcohols Due: Monday, April 14, 2008 The alcohol module in ORGO will give you a good review of some of the fundamental reactions discussed in class and
Yale - CHEM - 225
PS82/25/08 3:07 PMChem 225b - Comprehensive Organic Chemistry Problem Set 8 Chapter 9, Alkynes Due: April 7, 2008 Ozone In 1840, Christian Friedrich Schnbein (1799-1868) discovered ozone (Gr.; odorant), the sharp odor produced by electrical disch
Yale - CHEM - 225
PS-11/9/08 12:40 PMChem 225b - Comprehensive Organic Chemistry Problem Set 3 Chapter 4, Chemical Reactions Due: Monday, February 11, 2008 Dualism vs. Substitution Theory The prevailing theory of organic structure in the early 19th century was Dua