Top Banner
9. Chorus
42

9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Dec 16, 2015

Download

Documents

Dorothy Millett
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

9. Chorus

Page 2: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

History of Chorus Chorus started out at the French research institute INRIA in

1980, as a research project in distributed systems. It has since gone through four versions, numbered from 0 through 3.

The idea behind Version 0 was to model distributed applications as a collection of actors.

Version 1, which lasted from 1982 to 1984, focused on multiprocessor research.

Version 2 (1984-1986) was a major rewrite of the system, in C.

Version 3 was started in 1987. The version marked the transition from a research system to a commercial product.

Page 3: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Goals of Chorus 1. High-performance UNIX emulation.

2. Use on distributed systems.

3. Real-time applications.

4. Integrating object-oriented programming into Chorus.

Page 4: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

System Structure

u1 u3u2

s1

k1

s2

k2

s3

Microkernel

User process

System process

Kernel process

UNIX subsystem Object-oriented subsystem

User addr. space

Kerneladdr. space Management of

names, processes,threads, memory,and communication.

Page 5: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Six key abstractions

Microkernel Microkernel

network

message

Thread

Port: holding incomingmessages at any instant,each port belongs to one process.

Region of address space

Address space

Page 6: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

A capability in Chorus

Creationsite

Type Epoch number+ counter

Defined by the subsystem

Can indicate site, port, or port group;the other five combinations are reservedfor future use.

Bits 13 3 48 64

UI of a port key to distinguish objects

Page 7: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

An address space with four mapped regions

stack

file

data

program

Region

Unmapped address

Region

Unmapped address

Region

Region

Scratched segment

Mapped portion of file F

Unmapped portion of fileFCopy of program’s initial dataRead-only segment

Page 8: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Kernel structure

Supervisor (machine dependent)

Interprocess communicationmanager (portable)

Real-time executive(portable)

Virtual memory(portable)

Responsible for ports and messages

Handles, processes,threads, and scheduling

Caches traps,interrupts, and exceptions

Manages paging (low-level part ofthe paging system)

Machine-dependentPortion of the virtualMemory manager

Page 9: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

The UNIX Subsystem Since Chorus is now a commercial product, it must be

compatible with UNIX. Chorus accomplishes this goal by providing a standard subsystem, called MiX, that is compatible with System V.

MiX is also compatible with UNIX in other ways. For example, the file system is compatible, so Chorus can read a UNIX disk. Furthermore, the Chorus device drivers are interface compatible with the UNIX ones, so if UNIX device drivers exist for a device machine, they can be ported to Chorus with relatively littler work.

Page 10: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

The Object-Oriented Subsytem It consists of three layers. The bottom layer

does object management in a generic way and is effectively a microkernel for object-oriented systems. The middle layer provides a general runtime system. The top layer is the language runtime system. This subsystem, called COOL.

Page 11: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Process Management in Chorus A process in Chorus is a collection of

active and passive elements that work together to perform some computation. The active elements are the threads. The passive elements are an address space (containing some regions) and a collection of ports (for sending and receiving messages).

Page 12: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Three kinds of processes

User Untrusted Unpriviledged User User

System Trusted Unpriviledged User User

Kernel Trusted Privileged Kernel Kernel

Type Trust Privilege Mode Space

Page 13: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Privilege refers to the ability to execute I/O and other protected instructions.

Trust means that the process is allowed to call the kernel directly.

Page 14: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Threads Every thread has its own private context (i.e., stack,

program counter, and registers). A thread is tied to the process in which it was created, and

cannot be moved to another process. Chorus threads are known to the kernel and scheduled by

the kernel, so creating and destroying them requires making kernel calls.

An advantage of having kernel threads is that when one thread blocks waiting for some event (e.g., a message arrival), the kernel can schedule other threads. Another advantage is the ability to run different threads on different CPUs when a multiprocessor is available.

Page 15: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

The disadvantage of kernel threads is the extra overhead required to manage them.

Threads communicate with one another by sending and receiving messages.

Page 16: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Chorus distinguishes the following states, but they are not mutually exclusive:

1. ACTIVE – The thread is logically able to run.2. SUSPENDED – The thread has been

intentionally suspended.3. STOPPED – The thread’s process has been

suspended.4. WAITING – The thread is waiting for some

event to happen.

Page 17: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Two synchronization mechanisms Traditional semaphore, with operations UP

and DOWN. mutex, which is essentially a semaphore

whose values are restricted to 0 and 1. Mutexes are used only for mutual exclusion.

Page 18: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Scheduling CPU scheduling is done using priorities on a per-

thread basis. Each process has a priority and each thread has a

relative priority within its process. The absolute priority of a thread is the sum of its process’ priority and its own relative priority.

The kernel keeps track of the priority of each thread in ACTIVE state and runs the one with the highest absolute priority. On a multiprocessor with k CPUs, the k highest-priority threads are run.

Page 19: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

High priority

Low priority

These threadsare not timesliced

These threadsare timesliced

A

B

C D C D D C

Page 20: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Traps, Exceptions, and Interrupts Traps are intentional calls to the kernel or a

subsystem to invoke services. Programs cause traps by calling a system call library procedure. The system supports two ways of handling traps.

1. all traps for a particular trap vector go to a single kernel thread that has previously announced its willingness to handle that vector.

2. each trap vector is tied to an array of kernel threads, with the Chorus supervisor using the contents of a certain register to index into the array to pick a thread.

Page 21: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Exceptions are unexpected events that are caused by accident, such as the divide-by-zero exception, floating-point overflow, or a page fault.

Interrupts are caused by asynchronous events, such as clock ticks or the completion of an I/O request.

Page 22: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Kernel Calls for Process Management

actorCreate Create a new process

ActorDelete Remove a process

ActorStop Stop a process, put its threads in STOPPED state

actoreStart Restart a process from STOPPED state

actorPriority Get or set a process’ priority

actorExcept Get or set the port used for exception handling

Page 23: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

threadCreate Create a new thread

threadDelete Delete a thread

threadSuspend Suspend a thread

threadResume Restart a suspended thread

threadPriority Get or set a thread’s priority

threadLoad Get a thread’s context pointer

threadStore Set a thread’s context pointer

threadContext Get or set a thread’s execution context

Page 24: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

mutexInit Initialize a mutex

mutexGet Try to acquire a mutex

mutexRel Release a mutex

semInit Initialize a semaphore

semP Do a DOWN on a semaphore

semV Do an UP on a semaphore

Page 25: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Memory Management in Chorus A region is a contiguous range of virtual

address, for example, from 1024 to 6143. A segment is a contiguous collection of

bytes named and protected by a capability.

Page 26: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Mapping segments onto regions. It is not necessary that a segment be exactly the size of its region.

 1.      If the segment is larger than the region, only a portion of the segment will be visible in the address space, although which portion is visible can be changed by remapping it.

2.      If the segment is smaller than the region, the result of reading an unmapped address is up to the mapper. For example, it can raise an exception, return 0, or extend the segment.

Page 27: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Mappers Each mapper controls one or more

segments that are mapped onto regions. A segment can be mapped into multiple regions, even in different address spaces at the same time.

Page 28: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Segments can be mapped into multiple address space at the same time

S1

S2

Process A Segments Process B

Page 29: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Distributed Shared Memory Chorus supports paged distributed shard memory in

the style of IVY. IT uses a dynamic decentralized algorithm, meaning that different managers keep track of different pages, and the manager for a page change as the page moves around the system.

The unit of sharing between multiple machines is the segment. Segments are split up into fragments of one or more pages. At any instant, each fragment is either read-only, and potentially present on multiple machines, or read/write, and present only on one machine.

Page 30: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Kernel Calls for Memory Management

rgnAllocate Allocate a memory region and set its properties

rgnFree Release a previously allocated region

rgnInit Allocate a region and fill it from a given segment

rgnSetInherit Set the inheritance properties of a region

rgnSetPaging Set the paging properties of a region

rgnSetProtect Set the protection options of a region

rgnStat Get the statistics associated with a region

Page 31: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

sgRead Read data from a segment

sgWrite Write data to a segment

sgStat Request information about a page cache

sgFlush Request from a mapper to the kernel asking for dirty pages

Page 32: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

MpCreate Request to create a dummy segment for swapping

MpRelease Request asking to release a previously created segment

MpPullIn Request asking for one or more pages

MpPushOut Request asking mapper to accept one or more pages

Page 33: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Communication in Chorus The basic communication paradigm in

Chorus is message passing.

header An optional fixed part Optional body

Identifies the source and destinationand contains protection identifiers and flags.

64 bytes long Maximum of 64k bytes

Page 34: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

network

Port group 1 Port group 2

Page 35: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Communication Operations Two kinds of communication operations are

provided by Chorus: asynchronous send and RPC.

Asynchronous send allows a thread simply to send a message to a port. There is no guarantee that the message arrives and no notification if something goes wrong.

RPC uses blocking send and at-most-once semantics.

Page 36: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

To all

1 2 3

Page 37: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

To any

1 2 3

Page 38: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

To 1

1 2 3

Page 39: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Not to 1

1 2 3

Page 40: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

Kernel calls for communication

portCreate Create a port and return its capability

portDelete Destroy a port

portEnable Eanble a port so its messages count on a receive from all ports

portDisable Disable a port

portMigrate Move a port to a different process

Page 41: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

grpAllocate Create a port group

grpPortInsert Add a new port to an existing port gro

grpPortRemove Delete a port from a port group

Page 42: 9. Chorus. History of Chorus Chorus started out at the French research institute INRIA in 1980, as a research project in distributed systems. It has since.

ipcSend Send a message asynchronously

ipcReceive Block until a message arrives

ipcGetData Get the current message’s body

ipcReply Send a reply to the current message

ipcCall Perform a remote procedure call