FQViQg Operating systems design S H Kaisler
'The design of operating systems for small computer systems' John Wiley, New York, USA (1983)£26.50, pp 667 In this book the author quotes Professor D W Barron, who argued that he could not tell you what an OS (operating system) is but could recognize one when he saw it. This comment points out the dual problem of distinguishing the components that make up an OS as well as what services it should provide to the user. A dichotomy arises from the different, and often conflicting, viewpoints held by the user and the system designer. After studying this well organized book, one will certainly be able to recognize an OS and will also be well informed on OS objectives, resources managed by an OS, types of OS, and major concepts affecting OS design. These points are dealt with in an introductory chapter, which is followed by six chapters each dealing with an essential part of an OS. The text provides an examination of features and concepts in the design of OSs. The major trade-offs in space, time and functional flexibility are analysed and described for each feature of an OS. I n addition the design of the skeleton of a specific OS - a realtime executive multiprogramming system is described. The text is concerned with the design of OSs for small computer systems, which are defined in a general manner as being minicomputers and the more advanced microcomputers, ie 16b and 32b. The book is mainly intended for the computer science professional who is developing OS software for small computers. It should also help applications programmers to understand more about the internal structure and operation of the OS. A working knowledge of one ALGOL-like structured language is assumed, as is a comprehension of computer system technology with regard to data structures, programming techniques and computer hardware. In each chapter the text is supplemented by code skeletons and commentary which illustrate the various internal aspects
336
of OS structure and algorithms. This code is written in a pseudo-high-level language called PDL (program design language) which has a superficial resemblance to AiGOL and PASCAL. The six essential parts of an OS are treated under the following headings: device management, process management, memory management, I/O management, file management, and the user interface and utilities. The chapter on device management deals with the basic functions that any OS must perform, eg status tracking, device access, device control, device allocation and space allocation. The use of the database known as the device control block (DCB) is described. There are detailed sections, supported by code modules, on terminal management, line printer management, magnetic tape management, and disc management. Chapter three deals with process management. The process concept is an important tool for decomposing a discrete event system into components, each of which is separately describable. In general, a process has two aspects: it is a data carrier and it executes actions. Processes compete for the most valuable resource of all, a slice o f central processor time. This competition generates the requirements for managing processes and scheduling the use of the central processor. The main issues in process management are mutual exclusion, synchronization, deadlock, and interprocess communication. These problems and various methods of dealing with them are dealt with in detail. In the section on memory management the point is made that main memory is a resource as critical as
central processor time and that an important trade-off in OS design concerns the balance between execution time and memory usage. The five major functions of memory management are dealt with. These are mapping logical memory addresses to physical memory addresses, sharing physical memory among multiple users, allocating physical memory among multiple users, protecting both the OS's and the users' information from one another, and extending logical memory space beyond the maximum physical memory limit. I/O management is different from device management in that its function is to remove the user further from the physical hardware, and thus to distinguish between the logical and physical views of data. Mapping between the logical view and the physical representation on the peripheral device is the responsibility of the I/O manager (IOM). The primary motivation of an IOM is to support the principle of device independence. This chapter describes how the IOM furnishes an array of services, all of which are related to the logical structuring of data, which are essential in relation to device allocation, data staging, performance and scheduling. The final chapter deals with the user environment and deals with OS command languages, system generation, system initialization and system utilities. The book is well produced with a good index and an excellent reference section which includes a brief description of the contents of each reference. It is recommended to all concerned with the design evaluation or use of OSs.
Teaching Unix to beginners and users A N Lomuto and N Lomuto
',4 Unix primer' Prentice-Hal1, Englewood Cliffs, N], USA (1983) pp 239 S R Bourne
'The Unix system' Addison-Wesley, Reading, MA, USA (1982) pp 351 Developed more than ten years ago the Unix operating system is based on the philosophy that programming is facili-
tated by the provision of software tools. Written in the C programming language, Unix has a simple design which allows great flexibility. This flexibility has permitted the provision of hundreds of proven utilities, ie software tools, such as editors, debuggers, file managers and formatters. Unix features such assets as deviceindependent I/0 calls, modular program development with pipe-type
microprocessors and microsystems
interconnections, a pre-execution program duplication feature, hierarchical and recursive file structure, and a flexible shell. The Unix shell is a command line p~ocessor, a powerful high-level programming language in its own right. It allows for control statements, parameter passing, variables, and string substitution. It also has such programming constructs as while, if then else, case, and for. With all Unix programs, a shell can accept input from any specified source, and provide output to any destination. The Unix shell is not 'the shell'. It is a program and there can be multiple shells on a system. Because Unix is multitasking and recursive, each user can run under a unique shell. The shell permits custom command implementation. Unix is not user friendly; it is aimed at the experienced professional programmer. Those who swear by it also swear at it. The command shell assumes a high degree of programming knowledge. Novices usually struggle with its terse interface nomenclature, obscure abbreviations and insufficient feedback. There is no mechanism to lock records to prevent more than one user from accessing them simultaneously. Also a system crash can destroy the hierarchical file directory. These inadequacies are well known and can be remedied by custom shells and file protection enhancements. Now having briefly explored the assets and sophistication of Unix, we consider how these two books assist in understanding and using the system. A Unix primer, produced by a combination of a language teacher and a computer scientist, is what it declares itself to be - a primer - and is intended for the beginner. The book uses the notation of Unix version 7 and the authors have chosen the use of Unix for text processing as their theme. The organization of the material is in three levels: firstly basic procedures, editing and file handling, and automatic formatting; secondly efficient editing, and advanced formatting; thirdly advanced editing and the use of the shell commands in a limited manner. There are fresh analogies, accompanied by cartoons, to assist in understanding operating system functions, and amusing examples of text processing. This book is 'user friendly'. The authors
vol 7 no 7 sept 1983
confine themselves to use of the line editor ed, and like Bourne assume that the reader has access to a Unix system. By a beginner the Lomutos mean someone who is not only coming to Unix for the first time, but indeed to the use of operating systems and computers for the first time. The description of the shell is confined mainly to calling the various text processing utilities, and the bulk of the book is devoted to using these utilities. Level one consists of chapters one to six. Chapter one is really for the beginner and describes not only what Unix is, but also operating systems and the main computer components such as terminals, disc and tape drives. The second chapter deals with terminals and their characteristics. Then follows a chapter on logging in and the prompt, erase, kill and interrupt characters. Basic editing is dealt with in chapter four and covers insertion, deletion and substitution. It finishes with a timely explanation of the necessity for creating files. Chapter five treats basic file handling and introduces the use of the pr, Is, rm and mv commands. Concluding level one, chapter six deals with formatters and concentrates on the use of nroff and its requests for page layout, line layout, filling, centring, justification, etc. Level two, the intermediate level, consists of chapters seven to nine, which cover more advanced use of the ed facility, eg the m, c and backward search requests, the use of directories and file systems, and formatting features to produce tables and figures. The section on formatting features includes the use of tabs, macros and traps. The remaining three chapters in the advanced level cover special editing problems, eg how to give shell commands without leaving ed, large-scale editing and pattern matching features, and some shell procedures. Each major segment of the book concludes with a summary and exercises. A Unix primer is easy to read, clearly set out, and certainly meets its aim of introducing the beginner to Unix. The Unix system by S R Bourne is a different kind of book for a different kind of reader. Bourne, a member of the group responsible for Unix version 7, sets out to produce a practical guide to Unix for all users from the novice to the expert. This book is for the reader with operating system and high-
level language experience who wishes to understand, or come to a better understanding of, Unix. One-third of the book is devoted to appendices detailing system commands and calls, and adb, ed, sh, troff and vi requests. In addition to line editing and document preparation there are chapters on the c programming language, Unix system programming and data manipulation tools. The interactive use of the shell as a command language is introduced early. Later in the book the use of the shell as a programming language is covered. The chapter on Unix system programming describes the c interface to the Unix programming environment. The problems of writing programs that interface directly with the Unix system are discussed and topics include the creating and removing of files, creating processes, handling interrupts, sending signals, and the use of pipes. A number of data manipulation tools such as awk, cmp, comm, diff, grep, join, sed, sort, tail, tr and uniq are described and examples given of their use. The author makes the point that shell programming using commands as building blocks can be inefficient but it is often possible to produce a working system in a shorter time than if all the programs were written in C. Three examples are given illustrating applications well suited to these tools. One example is the maintenance of a simple database, iea telephone directory, which manages a list of phone numbers, names and addresses. A program to update the file with new information is shown. This program uses grep to look up name or numbers, and in the enter mode to check if numbers that are about to be added are already present. As the book covers in depth from getting started to data manipulation through editing, the shell, the c programming language, Unix system programming and documentation preparation, it would be wrong to pretend that it is a particularly easy book to read. However, it is well set out and indexed, and the experienced professional programmers for whom it is intended will find all the information they require and that their efforts in reading it will be well rewarded.
] Gallacher Microprocessors Systems Engineering Ltd 337