1 / 19

Case Study: Mach

Mach: Overview. Mach is a microkernel that provides the most elementary services needed for an operating system. It is not a complete operating system.More advanced operating system functions are handled by separate user-space server programs that run on top of and communicate with Mach.Mach's

yauvani
Download Presentation

Case Study: Mach

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


    1. Case Study: Mach David Ramsey 3-17-2003 CPSC550

    2. Mach: Overview Mach is a microkernel that provides the most elementary services needed for an operating system. It is not a complete operating system. More advanced operating system functions are handled by separate user-space server programs that run on top of and communicate with Mach. Mach's only functions are to keep the servers running and to coordinate their access to raw hardware. At its most basic level, it is an event handler, not an operating system as such.

    3. Mach: History (1) 1985: Beginning of Project Mach A research project at the Carnegie Mellon University School of Computer Science 1994: End of Project Mach at CMU (Mach 3.0) All goals of the research project were accomplished by then Other organizations are continuing to work on Mach today 1995-1996: Work on Project Mach at the University of Utah (Flexmach, which became Mach 4)

    4. Mach: History (2) During testing, BSD was ported to run on top of Mach so that it could be tested as part of a running system Its main purpose was just to get a running system It consisted of the monolithic BSD kernel converted into one user-space server program, instead of into one user-space server for each individual service Due to this, Mach's performance on it was very poor This was not the last attempt at porting BSD to Mach, however

    5. Mach: History (3) Some other projects based on Mach technology: GNU Hurd: Free Software Foundation (Mach 3.0 & 4) LITES: Helsinki University of Technology (Mach 3.0 & 4) Darwin: Apple (Mach 3.0) NeXTStep: NeXT (Mach 2.5) OSF/1 Unix: Open Software Foundation (Mach 2.5 & 3.0) The last three of these successfully run Mach on top of BSD, getting better performance by running the latter inside the former (i.e, at kernel level instead of user level)

    6. Mach: Goals Mach's goals are to cover all basic features commonly found and/or desired in operating systems, and to be compatible with BSD Unix The basic features are: Direct communication between applications Memory protection Multiple processor support Multitasking Multithreading

    7. Mach: Definitions Abstractions Messages: data sent from and received by tasks Ports: unicast, unidirectional message queues used by tasks Port sets: sets of ports on which tasks wait until they receive a response from any one port in the set Port rights: what tasks use in order to make use of ports (send rights, send-once rights, and receive rights) Threads: tasks contained inside other (multithreaded) tasks

    8. Mach: Features Portability, needed for Mach's elementary operating system services to work on a wide variety of machines with different capabilities Transparent network operation, needed for the possibility that the servers providing advanced services for it are running on different machines (i.e, that the system is distributed) Distributed virtual memory, needed for Mach's method of transferring out-of-line data between tasks All features needed to implement Mach's stated goals

    9. Mach: Structure (1) Abstractions The interprocess sommunication system primitives operate only on the abstractions of messages, ports, port sets, port rights, and tasks Port sets Port sets are accessible only via the kernel-exported interface Any given port can belong to only one port set Send rights More than one task can have send rights to any given port

    10. Mach: Structure (2) Send-once rights Send-once rights only allow the tasks holding them to send messages once, after which the rights are lost Receive rights Only one task can hold receive rights for a given port or port set A port receive right can be transferred by a message from the task that holds it, but a port set receive right cannot If no task has the receive right for a port, the messages sent to the port are queued until one gets it

    11. Mach: Structure (3) Tasks Any given task, when first created, starts with a bootstrap port right, send rights to a kernel port, and send and receive rights to an exception port A task uses its kernel port to invoke kernel services (which include performing operations on itself, creating new threads, and the like) On an exception associated with an exception port, the kernel sends a message containing a description of the exception to the port, the task tries to fix the problem and indicates success or failure via a message, and the kernel restarts or terminates it

    12. Mach: Structure (4) Out-of-line data transfer Out-of-line data is transferred from one task to another via messages The address of the data in the former's address space is included in the message body When the latter receives the message, the data is put in an unused region of its address space During the transmission, the former and latter share the data pages, which are copied only upon their being written to (copy-on-write); up to one address space-worth of data can be transmitted at a time

    13. Mach: How to Use It (1) One uses Mach mainly by sending messages to it and receiving messages from it, subject to its constraints Not all kernel interface calls will be described here, and not in all detail, since there are over 100 Message call API: #include mach/port.h and mach/message.h mach_msg_return_t mach_msg (mach_msg_header_t *msg, mach_msg_option_t option, mach_msg_size_t send_size, mach_msg_size_t rcv_size, mach_port_t rcv_name, mach_msg_timeout_t timeout, mach_port_t notify)

    14. Mach: How to Use It (2) Mach message format: a fixed size message header (mach_msg_header_t) followed by an optional number of data items each data item contains a type descriptor followed by data (or a data address, in the case of out-of-line data transfers) Mach message data types: mach_msg_bits_t: unsigned int corresponding to the flags associated with a message mach_msg_size_t: unsigned int corresponding to the size of a message

    15. Mach: How to Use It (3) Mach message data types (continued): mach_msg_id_t: integer_t used to indicate a function or operation id number All messages start with the mach_msg_header_t Data port types: mach_port_t: unsigned int corresponding to a port name A port can be blocked from being used by marking it as a 'dead name' Etc.

    16. Mach: Applications Operating system emulation Mach can intercept operating system calls and redirect them to servers that can handle them, allowing emulation of that operating system Efficient sharing of hardware resources between programs on one or more machines Mach's mathods of interfacing to servers at unknown, possibly non-local, locations allow this

    17. Mach: Significance It is a first-generation microkernel It is designed for use in Unix-based or Unix-like distributed operating systems It can emulate systems by acting as a middleman, so to speak, between the emulated layer and the real layer It is good as a proof of concept (since second-generation microkernels such as L4 perform better than it does and are less complex)

    18. Mach: Summary Mach is a microkernel designed to be the core of a distributed UNIX-like system. It communicates via sending messages directly between different applications via ports, and handles only the most basic operating system functions on its own. More advanced functions are handled by servers that it interfaces with. It transparently handles multiple processors, networks, multitasking, multithreading, and memory protection, and virtual memory. It can be used to emulate other operating systems as well by intercepting calls from the emulated system and sending them to its servers to be handled. It is an interfacer and scheduler.

    19. Sources (1) The Evolution of Darwin http://developer.apple.com/darwin/history.html Lites Home Page http://www.cs.hut.fi/~jvh/lites.html The Mach 4 Project http://www.cs.utah.edu/flux/mach4/html/Mach4-proj.html The Mach Project Home Page http://www-2.cs.cmu.edu/afs/cs/project/mach/public/www/mach.html http://www-2.cs.cmu.edu/afs/cs/project/mach/public/www/status.html Mach kernel - Wikipedia http://www.wikipedia.org/wiki/Mach_kernel

    20. Sources (2) Coulouris, George, et al. Distributed Systems: Concepts and Design. 3rd ed. Essex: Pearson Education Limited, 2001. 700-706, 719-720 The GNU Mach Reference Manual: Inter Process Communication http://www.gnu.org/software/hurd/gnumach-doc/mach_1.html http://www.gnu.org/software/hurd/gnumach-doc/mach_4.html

More Related