Helsinki, 10.10.1997
UNIVERSITY OF HELSINKI
Department of Computer Science
1. INTRODUCTION
2. OS68 OVERVIEW
3. PROCESS AND ITS STATES
4. PROCESS TYPES AND SCHEDULING IN OS68
5. INTERPROCESS COMMUNICATION IN OS68
6. SOFTWARE DEVELOPMENT FOR EMBEDDED SYSTEMS
7. SUMMARY
1. IntroductionReal-time operating systems (OS) can be categorized into three groups: small, proprietary kernels(commercially available as well as homegrown kernels), real-time extensions to commercial timesharing operating system such as UNIX, and research kernels / 1 /. OS68 is a real-time operating system designed to be operated on Motorola 68000 family processes. It is a small, proprietary, commercially available real-time operating system most often used for developing embedded systems. Typical examples of embedded systems are telecommunication equipment such as digital telephone switches, factory instrumentation and control systems, industrial robots. A real-time operating system is designed to do the work that is done in almost every real-time system. It is intended to replace the control loops, jumps, calls and global variables that would otherwise control program execution. The major task of a real-time operating system consists resource management (e.g., management of CPU, memory or various hardware), time management (e.g., scheduling activities in specified time or specified period) and interprocess communication. In the following chapter we will give an overview of OS68 and in chapter 3 we will introduce the concepts of process and its state. In chapter 4 we will present the types of processes in OS68 and the scheduling principles. In chapter 5 we will describe the interprocess communication mechanisms in OS68 and chapter 6 presents some practical aspects of software development for embedded system in OS68 operating system environment. 2. OS68 OVERVIEWOS68 real-time operating system consists of a small configurable executive kernel and a set of system tools such as debugging tools, target simulation tools. The executive kernel is small in size about 11 kilo bytes in binary. It is simple due to its very limited set of system calls. The design goals of OS68 are easy to use, efficient debugging tools and high performance. Easy to use: The number of system calls used in OS68 design are reduced compared to other operating systems. 90 - 100% of the processes in a system need 6 or fewer system calls. It is recommended to be restrictive when using tools other than the six basic calls. The six basic calls are: ALLOC Allocate memory FREE_BUF Return allocated memory to OS SEND Send a message to a process RECEIVE Receive selected messages, sleep if no selected message is available. RECEIV_W_TMO Like RECEIVE, but wake up again after a specified time if no message is available. DELAY Sleep for a specific time. Efficient debugging tools improve application development, and high performance is due to configurable OS system according to specific application or specific processor families. 3. PROCESS AND ITS STATESA process is an independent program running under real-time operating system. A process running under a real-time operating system can find itself in one of three distinctly different states. RUNNING: The process is the one currently in control of the CPU. In a single process system, only one process can be in this state at a time. READY: The process needs the CPU and will be running as soon as it is permitted to do so. However, another process of higher or equal priority is RUNNING and the READY process must wait until all READY process of higher priority are waiting WAITING: The process is waiting for something, for example a message, and has no need of the CPU. 4. PROCESS TYPES AND SCHEDULING IN OS68The most frequently used task/process scheduling paradigm of the currently available commercial real-time operating system kernels is the preemptive priority-based scheme. The OS68 executive is also based on this paradigm / 2 / . The scheduling principle is simple: Always executes the highest-priority process of the ready processes. Preemption in this context means that the scheduler may (virtually) at any time suspend a running low-priority process for a higher-priority process. Priority can be either fixed or dynamic. It is the responsibility of the application designer to assign the right priority to the right processes. OS68 provided 32 priority-levels with 0 the highest priority level and 31 the lowest-priority level. The OS68 operating system provides four different types of processes: prioritized process, background processes, interrupt processes and timer processes. Prioritized processes operate on different priority levels. Processes on higher priority level always run before processes of lower priority. A prioritized process will run as long as it desires unless a process of higher priority becomes ready. If processes of equal priority are ready, one is choose by random. A process can wait for one or more specified signals to arrive. If none of them is present in its queue the process is swapped out and other process is allowed to run. A process is swapped in if all processes on higher priority levels are not ready and the process itself is or become ready, for example when another process sends a message to it. A prioritized process must never end. When its task is done it should return to the beginning and waiting for another request for its service. It is an error for an OS68 process to execute a return statement. A prioritized process may be interrupted between almost any two assembler instructions and in the middle of any high-level language instruction and inside system calls. Background processes are almost the same as the prioritized processes with one exception: if there is more than one ready background processes at a priority level. The running process will be interrupted by the OS after a time and the next background process will be allowed to run. Interrupt Processes: An interrupt process is immediately called whenever the corresponding interrupt occurs, provided that no other interrupt of higher or equal hardware priority is running. An OS68 interrupt process will never become waiting; it is run from beginning to the end each time it is activated. It is impossible for an interrupt process to wait for a signal or make a delay. OS68 timer interrupt processes are identical to interrupt processes for the manner in which they are called. For each time-interrupt process, the user selects a time to elapse between each call of the process. Timer-interrupt process should be short (e.g., execute during one system tick). Timer-interrupt processes have the same hardware priority as system timer-interrupts. 5. INTERPROCESS COMMUNICATION IN OS68Most real-time systems are inherently concurrent systems. Every process in the system may be related to other processes in one way or another. When partitioning a real-time system into process, the designer tries to keep them as isolated as possible. Ideally, there should be no ties between processes. Interprocess ties can appear in many forms: global variables, subroutine calls, timing relationships, priority relationships, interrupt disables, semaphores, messages, etc. Unfortunately, it is often necessary to have communication between processes. Therefore, a good system design should be that processes have few ties to each other. Interprocess communication is one of the very important tasks of real-time operating systems. Interprocess communication is channeled through the operating system for the following reasons
Messages and message passing in OS68 When a process wants to receive a message, it calls the OS requesting a message. If none is available, the OS put the process to sleep until one has arrived. When process wants to send a message, it calls the OS, submitting the message. If the address is of higher priority or a higher priority process is sleeping at the mailbox in question, the calling process is put to sleep and the higher priority process is allowed to use the CPU. A message is often actually a buffer, an area of memory, where processes may read and write data. A buffer may be used by many different processes, but only one process at a time may access a buffer. Messages not only carry data, they may also initiate actions by the various processes. 6. SOFTWARE DEVELOPMENT FOR EMBEDDED SYSTEMSHost environment vs. target environment The embedded computer in an embedded system typically is either a custom design using standard microprocessor or a single-board computer. The microprocessor may be one of a number of popular chips; the most widely used are the Intel 8086 and Motorola M68000 families. Software development for embedded systems is typically done on a general purpose computer system such as Unix system or personal computer with Windows or NT operating systems. Therefore, a simulation or emulation of the target processor as well as the target operating system would of great importance when concerning the development efficiency. Even in many cases the target environment is not available until the later stage of the software development phase. When develop embedded system with OS68 and M68000 family processor, target environment simulators are commercially available. Identify the process types and assign proper priority When developing application for embedded system using a real-time operating system such as OS68 where preemptive priority-based schedule scheme is implemented, the partitioning system function into processes, and assigning proper priority level to each of the identified processes are of great importance. This part of work is often titled as system design or architecture design. However, the general principle is that the stricter the task response time requirement, the higher the priority for the process to implement the task. Another general principle is that the higher priority the process be assigned, the short the execution time is desirable. Design for clear process communication An important task of a real-time operating system is to provide interprocess communication (IPC) service. There are in general two types of IPC mechanisms: shared memory and message passing. If two processes can access shared memory, communication between them can be realized by shared memory. The major advantage of this type IPC is the speed and less overhead, especially when large number of daua are exchanged between the two processes. The disadvantage is that when the number of process increase, the process interaction increase, to correctly build and manage such a system is not easy and may be error prone. Message passing is another form of realizing interprocess communication and synchronization. Messages in OS68 are called signals. Message passing operation can be either synchronous or asynchronous. The OS68 sending operations is asynchronous (the sender does not wait for the receiver to get the message). The receiver may choose to wait for a message to come or control the waiting with a timeout. The OS68 signal naming is direct (e.g., the sender provides the name of the receiving process). Message passing is considerable safe, and more manageable than share memory of IPC. Memory awareness in process design and implementation In general, embedded systems have very limited memories and the real-time operating system usually does not handle the out-of-memory condition gracefully (usually cause system crashes when it runs out of memory). Another important reason is that the detection of memory problem usually can not be detected in simulation environment, and target testing is usually in the late stage of software development. Speed consideration, robustness, compilation dependencies etc. are also of great importance to embedded system. 7. SUMMARYThis paper presented OS68, a real-time operating system for embedded system, as a case study of real-time operating systems. OS68 is a small, proprietary, commercially available real-time operating system. It is mainly designed for Motorola M68000 microprocessor family. An over view of OS68 was presented. Process is an important concept in OS68. Therefore the definition of process, the three states of a process were described in context of OS68. The four types of processes provided by OS68 and their relations to OS68 scheduler were discussed. Interprocess communication is another important task of a real-time operating system. OS68 facilitates interprocess communication with message passing operations. In the end, a number of practical aspects of software development for embedded system were pointed out and discussed. References
Last updated on 10.10.1997 by Xian Ming Song | ||||