220 likes | 240 Views
On the Duality of Operating System Structures. - Lauer, Needham. Presented by Myoungkyu Song. Contents. Key Point Message-Oriented System Structure Procedure-Oriented System Structure Duality Mapping Similarity of Programs Preservation of Performance Conclusion Evaluation. Key Point.
E N D
On the Duality of Operating System Structures - Lauer, Needham Presented by Myoungkyu Song
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
Key Point • 1970's - in those days of this paper Message-oriented Structure / Procedure-oriented Structure • Modern Event-based Model / Thread-based Model • Thread-based System Structure need Data Protection Mechanism. • But, Event-based System Structure do not have it so, any process do MUST NOT WAIT.
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
Message-Oriented System Structure • Relatively small, static number of processes • With an explicit message system for communicating among them
Message-Oriented System Structure begin m : messageBody i: messageId; p:portId; s: set of portId; initialize; do forever; [m,i,p] <- WaitForMessage[s]; case p of port1 => ...; --algorithm for port1 port2 => ... if resourceExhausted then s <- s - port2; SendReply [i, reply]; ...; --algorithm for port2 ... portk => ... s <- s + port2 ...; --algorithm for portk endcase endloop end. { ResourceManager(int n) { // initialize } run() { while (true) { msg = WaitForMessage (s); p = msg.getPort (); if ( p == acquire ) { r = resourceAvailable.pop (); if (resourceAvailable.empty() ) s.remove (acquire); msg.sendReply( r ); } else if (p == release) { resourceAvailable.push( (Resource) msg.getBody()); s.add (acquire); } } // endloop [ Example Code in Java style ] class ResourceManager extends Thread (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
Procedure-Oriented System Structure • Large, rapidly changing number of small Processes • Cooperation among process is achieved by locks, semaphore, monitor, or other synchronizing data structure
Procedure-Oriented System Structure ResourceManager:MONITOR = c: CONDITION; resourceExhausted:BOOLEAN; proc1:ENTRY PROCEDURE[...] = ...;--algorithm for proc1 proc2:ENTRY PROCEDURE[...] RETURN[...] = BEGIN IF resourceExhausted THEN WAIT c; ... RETURN[results]; END; ... procL:ENTRY PROCEDURE[...] = BEGIN ...; resourceExhausted <- FALSE; SIGNAL c; ...; END; endloop initialize; END. synchronized Resource acquire() { while (resourcesAvailable.isEmpty()) try { wait(); } catch (InterruptedException ie) { } return resourcesAvailable.pop(); } synchronized void release(Resource r) { resourcesAvailable.push(r); notify(); } [ Example Code in Java style ] ResourceManager (int n) { resourcesAvailable = new Stack<Resource>(); for (int i = 1; i <= n; i++) { resourcesAvailable.push( Rsc Obj ); } }
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
The duality Mapping & Similarity (contd.) • The wait statement in the procedure-oriented model provides a considerably richer synchronization facility than does selective waiting for messages in the message-oriented model. • However, this is NOT without its disadvantage.
The duality Mapping & Similarity (contd.) • 'Selective Waiting' allows Message-oriented System to • wait for more than a single rendezvous at any time. • time-out if no rendezvous is forthcoming within a specified time. • withdraw its offer to communicate if no rendezvous is available immediately • terminate if no clients can possibly call its entries
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
Preservation of Performance • Process switching can be made equally fast in either system • Virtual memory and paging or swapping can even be used with • equal effectiveness in either model
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
Conclusion • Which Kinds of systems are "better" to build • Designer needs to perceive until too late after the system starts to operate
Contents • Key Point • Message-Oriented System Structure • Procedure-Oriented System Structure • Duality Mapping • Similarity of Programs • Preservation of Performance • Conclusion • Evaluation
Evaluation Example: To manage to control when Slide Up and Down fast repeatedly. In this case Message-Queue is needed. So, Message-oriented is Better. UI PROCESS :EVENT RECEIVER KEY PROCESS :EVENT SENDER Slide Up Slide Down SLIDE_UP_EVENT SLIDE_DOWN_EVENT SLIDE_UP_EVENT MESSSAGE QUEUE SLIDE_DOWN_EVENT SLIDE_UP_EVENT SLIDE_DOWN_EVENT SLIDE_UP_EVENT SLIDE_DOWN_EVENT