Unformatted text preview:

CS162 Operating Systems and Systems Programming Lecture 9 Tips for Working in a Project Team Cooperating Processes and Deadlock September 26 2008 Prof John Kubiatowicz http inst eecs berkeley edu cs162 Review Definition of Monitor Semaphores are confusing because dual purpose Both mutual exclusion and scheduling constraints Cleaner idea Use locks for mutual exclusion and condition variables for scheduling constraints Monitor a lock and zero or more condition variables for managing concurrent access to shared data Use of Monitors is a programming paradigm Lock provides mutual exclusion to shared data Always acquire before accessing shared data structure Always release after finishing with shared data Condition Variable a queue of threads waiting for something inside a critical section Key idea allow sleeping inside critical section by atomically releasing lock at time we go to sleep Contrast to semaphores Can t wait inside critical section 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 2 Review Programming with Monitors Monitors represent the logic of the program Wait if necessary Signal when change something so any waiting threads can proceed Basic structure of monitor based program lock while need to wait condvar wait unlock Check and or update state variables Wait if necessary do something so no need to wait lock condvar signal Check and or update state variables unlock 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 3 Goals for Today Tips for Programming in a Project Team Language Support for Synchronization Discussion of Deadlocks Conditions for its occurrence Solutions for breaking and avoiding deadlock Note Some slides and or pictures in the following are adapted from slides 2005 Silberschatz Galvin and 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 4 Gagne Many slides Gagne generated from my lecture notes Tips for Programming in a Project Team Big projects require more than one person or long long long time Big OS thousands of personyears It s very hard to make software project teams work correctly Doesn t seem to be as true of big construction projects Empire state building finished in one year staging iron production thousands of miles away Or the Hoover dam built towns to hold workers You just have Is it OK to miss deadlines to get your We make it free slip days synchronization right 9 29 08 Reality they re very expensive as time to market is one of the most important things Kubiatowicz CS162 UCB Fall 2007 Lec 9 5 Big Projects What is a big project Time work estimation is hard Programmers are eternal optimistics it will only take two days This is why we bug you about starting the project early Had a grad student who used to say he just needed 10 minutes to fix something Two hours later Can a project be efficiently partitioned Partitionable task decreases in time as you add people But if you require communication Time reaches a minimum bound With complex interactions time increases Mythical person month problem 9 29 08 You estimate how long a project will take Starts to fall behind so you add more people Project takes even CS162 more UCB time Kubiatowicz Fall 2007 Lec 9 6 Techniques for Partitioning Tasks Functional Person A implements threads Person B implements semaphores Person C implements locks Problem Lots of communication across APIs If B changes the API A may need to make changes Story Large airline company spent 200 million on a new scheduling and booking system Two teams working together After two years went to merge software Failed Interfaces had changed documented but no one noticed Result would cost another 200 million to fix Task Person A designs Person B writes code Person C tests May be difficult to find right balance but can focus on each person s strengths Theory vs systems hacker Since Debugging is hard Microsoft has two testers for each programmer Most CS162 project teams are functional but people have had success with task based divisions 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 7 Communication More people mean more communication Changes have to be propagated to more people Think about person writing code for most fundamental component of system everyone depends on them Miscommunication is common Index starts at 0 I thought you said 1 Who makes decisions Individual decisions are fast but trouble Group decisions take time Centralized decisions require a big picture view someone who can be the system architect Often designating someone as the system architect can be a good thing Better not be clueless Better have good people skills Better let other people do work 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 8 Coordination More people no one can make all meetings They miss decisions and associated discussion Example from earlier class one person missed meetings and did something group had rejected Why do we limit groups to 5 people You would never be able to schedule meetings otherwise Why do we require 4 people minimum You need to experience groups to get ready for real world People have different work styles Some people work in the morning some at night How do you decide when to meet or work together What about project slippage It will happen guaranteed Ex phase 4 everyone busy but not talking One person way behind No one knew until very end too late Hard to add people to existing group Members have already figured out how to work Kubiatowicz CS162 UCB Fall 2007 together 9 29 08 Lec 9 9 How to Make it Work People are human Get over it People will make mistakes miss meetings miss deadlines etc You need to live with it and adapt It is better to anticipate problems than clean up afterwards Document document document Why Document Expose decisions and communicate to others Easier to spot mistakes early Easier to estimate progress What to document Everything but don t overwhelm people or no one will read Standardize One programming format variable naming conventions tab indents etc Comments Requires effects modifies javadoc 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 10 Suggested Documents for You to Maintain Project objectives goals constraints and priorities Specifications the manual plus performance specs This should be the first document generated and the last one finished Meeting notes Document all decisions You can often cut paste for the design documents Schedule What is your anticipated timing This document is critical Organizational Chart Who is responsible for what task 9 29 08 Kubiatowicz CS162 UCB Fall 2007 Lec 9 11 Use Software Tools


View Full Document

Berkeley COMPSCI 162 - Lecture 9 Tips for Working in a Project Team/ Cooperating Processes and Deadlock

Documents in this Course
Lecture 1

Lecture 1

12 pages

Nachos

Nachos

41 pages

Security

Security

39 pages

Load more
Loading Unlocking...
Login

Join to view Lecture 9 Tips for Working in a Project Team/ Cooperating Processes and Deadlock and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture 9 Tips for Working in a Project Team/ Cooperating Processes and Deadlock and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?