UNIX
eBook - ePub

UNIX

The Textbook, Third Edition

  1. 1,344 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

UNIX

The Textbook, Third Edition

About this book

UNIX: The Textbook, Third Edition provides a comprehensive introduction to the modern, twenty-first-century UNIX operating system. The book deploys PC-BSD and Solaris, representative systems of the major branches of the UNIX family, to illustrate the key concepts. It covers many topics not covered in older, more traditional textbook approaches, such as Python, UNIX System Programming from basics to socket-based network programming using the client-server paradigm, the Zettabyte File System (ZFS), and the highly developed X Windows-based KDE and Gnome GUI desktop environments.

The third edition has been fully updated and expanded, with extensive revisions throughout. It features a new tutorial chapter on the Python programming language and its use in UNIX, as well as a complete tutorial on the git command with Github. It includes four new chapters on UNIX system programming and the UNIX API, which describe the use of the UNIX system call interface for file processing, process management, signal handling, interprocess communication (using pipes, FIFOs, and sockets), extensive coverage of internetworking with UNIX TCP/IP using the client-server software, and considerations for the design and implementation of production-quality client-server software using iterative and concurrent servers. It also includes new chapters on UNIX system administration, ZFS, and container virtualization methodologies using iocage, Solaris Jails, and VirtualBox.

Utilizing the authors' almost 65 years of practical teaching experience at the college level, this textbook presents well-thought-out sequencing of old and new topics, well-developed and timely lessons, a Github site containing all of the code in the book plus exercise solutions, and homework exercises/problems synchronized with the didactic sequencing of chapters in the book. With the exception of four chapters on system programming, the book can be used very successfully by a complete novice, as well as by an experienced UNIX system user, in both an informal and formal learning environment.

The book may be used in several computer science and information technology courses, including UNIX for beginners and advanced users, shell and Python scripting, UNIX system programming, UNIX network programming, and UNIX system administration. It may also be used as a companion to the undergraduate and graduate level courses on operating system concepts and principles.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access UNIX by Syed Mansoor Sarwar,Robert M. Koretsky in PDF and/or ePUB format, as well as other popular books in Computer Science & Operating Systems. We have over one million books available in our catalogue for you to explore.
CHATER 1
Overview of Operating Systems
Objectives
• To explain what an operating system is
• To describe briefly operating system services
• To describe character and graphical user interfaces
• To discuss different types of operating systems
• To describe briefly the UNIX operating system
• To give an overview of the structure of a contemporary system
• To describe briefly the structure of the UNIX operating system
• To detail some important system setups
• To describe briefly the history of the UNIX operating system
• To provide an overview of the different types of UNIX systems
1.1 INTRODUCTION
Many operating systems are available today, some general enough to run on any type of computer (from a personal computer, or PC, to a mainframe), and some specifically designed to run on a particular type of computer system, including real-time computer systems used to control the movement of mechanical devices such as robots, tablet computers, and cell phones. In this chapter, we describe the purpose of an operating system and the different classes of operating systems. Before describing different types of operating systems and where UNIX fits in this categorization, we present a layered diagram of a contemporary computer system and discuss the basic purpose of an operating system. We then describe different types of operating systems and the parameters used to classify them. Then, we identify the class that UNIX belongs to and briefly discuss the different members of the UNIX family.
The people who use UNIX comprise application developers, systems analysts, programmers, administrators, business managers, academicians, and people who just wish to read their e-mail. From its earliest inception in 1969 as a laboratory research tool, it was further developed in the academic community, and then endorsed for commercial uses. In its version today, UNIX has an underlying functionality that is complex but easy to learn, and extensible yet easily customized to suit a user’s style of computing. One key to understanding its longevity and its heterogeneous appeal is to study the history of its evolution.
1.2 WHAT IS AN OPERATING SYSTEM?
A computer system consists of various hardware and software resources, as shown in a layered fashion in Figure 1.1. The primary purpose of an operating system is to facilitate easy, efficient, fair, orderly, and secure use of these resources. It allows the users to employ application software—spreadsheets, word processors, Web browsers, e-mail software, and other programs. Programmers use language libraries, system calls, and program generation tools (e.g., text editors, compilers, and version control systems) to develop software. Fairness is obviously not an issue if only one user at a time is allowed to use the computer system, including single-user desktop systems, laptops, tablet computers, and cell phones. However, if multiple users are allowed to use the computer system, fairness and security are two main issues to be tackled by the operating system designers.
Hardware resources include keyboards, touch pads, display screens (may also be touch screens), main memory (commonly known as random access memory or RAM), disk drives, network interface cards (NICs), and central processing units (CPUs). Software resources include applications such as word processors, spreadsheets, games, graphing tools, picture- and video-processing tools, and Internet-related tools such as Web browsers. These applications, which reside at the topmost layer in the diagram, form the application user interface (AUI). The AUI is glued to the operating system kernel via the language libraries and the system call interface. The system call interface comprises a set of functions that can be used by the applications and library routines to execute the kernel code for a particular service, such as reading a file. The language libraries and the system call interface comprise what is commonly known as the application programmer interface (API). The kernel is the core of an operating system, where issues like CPU scheduling, memory management, disk scheduling, and interprocess communication are handled. The layers in the diagram are shown in an expanded form for the UNIX operating system in Figure 1.2, where we also describe them briefly.
There are two ways to view an operating system: top down and bottom up. In the bottom-up view, an operating system can be viewed as a software that allocates and deallocates system resources (hardware and software) in an efficient, fair, orderly, and secure manner. For example, the operating system decides how much RAM space is to be allocated to a program before it is loaded and executed. The operating system ensures that only one file is printed on a particular printer at a time, prevents an existing file on the disk from being accidentally overwritten by another file, and further guarantees that, when the execution of a program given to the CPU for processing has been completed, the program relinquishes the CPU so that other programs can be executed. Thus the operating system can be viewed as a resource manager.
In the top-down view, which we espouse in this textbook, an operating system can be viewed as a piece of software that isolates you from the complications of hardware resources. You therefore do not have to deal with the extremely difficult (and sometimes impossible for most users) task of interacting with these resources. For example, as a user of a computer system, you don’t have to write the code that allows you to save your work as a file on a hard disk, use a mouse as a point-and-click device, use a touch screen or touch pad, or print on a particular printer. Also, you do not have to write new software for a new device (e.g., mouse, disk drive, or DVD) that you buy and install in your system. The operating system performs the task of dealing with complicated hardware resources and gives you a comprehensive machine with a simple, ready-to-use interface. This machine allows you to use simple commands to retrieve and save files on a disk, print files on a printer, and play movies from a DVD. In a sense, the operating system provides a virtual machine that is much easier to deal with than the physical machine. You can, for example, use a command such as cp memo letter to copy the memo file to the letter file on the hard disk in your computer without having to worry about the location of the memo and letter files on the disk, the structure and size of the disk, the brand of the disk drive, and the number or name of the various drives (floppy, CD-ROM, and one or more hard drives) on your system.
Image
FIGURE 1.1 A layered view of a contemporary computer system.
Image
FIGURE 1.2 Software architecture of the UNIX operating system.
1.3 OPERATING SYSTEM SERVICES
An operating system provides many ready-made services for users. Most of these services are designed to allow you to execute your software, both application programs and program development tools, efficiently and securely. Some services are designed for housekeeping tasks, such as keeping track of the amount of time that you have used the system. The major operating system services therefore provide mechanisms for following secure and efficient operations and processes:
• Execution of a program
• Input and output operations performed by programs
• Communication between processes
• Error detection and reporting
• Manipulation of all types of files
• Management of users and security
A detailed discussion of these services is outside the scope of this textbook, but we discuss them briefly when they are relevant to the topic being presented.
1.4 CHARACTER (COMMAND LINE) VERSUS GRAPHICAL USER INTERFACES
In order to use a computer system, you have to give commands to its operating system. An input device, such as a keyboard, is used to issue a command. If you use the keyboard to issue commands to the operating system, the operating system has a character user interface (CUI), commonly known as the command line interface. If the primary input device for issuing commands to the operating system is a point-and-click device, such as a mouse, a touch screen, or a touch pad, the operating system has a graphical user interface (GUI). Most, if not all, operating systems have both character and graphical user interfaces, and you can use either. Some have a command line as their primary interface but allow you to run software that provides a GUI. Operating systems such as DOS and UNIX have CUIs, whereas Mac OS, OS/2, and Microsoft Windows primarily offer GUIs but have the capability to allow a user to enter a DOS- or UNIX-like terminal screen. Although UNIX comes with a CUI as its basic interface, it can run software based on the X Window System (Project Athena, MIT) that provides a GUI interface. Moreover, most UNIX systems now have a state-of-the-art X-based GUI. Mac OS X (Darwin), running on Apple products, is the most well-known GUI-based UNIX system. We discuss the UNIX GUI in Chapter 23.
Although a GUI makes a computer easier to use, it gives you an automated setup with reduced flexibility. A GUI also presents an extra layer of software between you and the task that you want to perform on the computer, thereby making the task slower. In contrast, a CUI gives you ultimate control of your computer system and allows you to run application programs any way you want. A CUI is also more efficient because a minimal layer of software is needed between you and your task on the computer, thereby enabling you to complete the task faster. It is also malleable and gives the user more control. Because many people are accustomed to the graphical interfaces of popular gizmos and applications such as Nintendo and Web browsers, the character interface presents an unfamiliar and sometimes difficult style of communicating commands to the computer system. However, computer science students are usually able to meet this challenge after a few hands-on sessions.
1.5 TYPES OF OPERATING SYSTEMS
Operating systems can be categorized according to the number of users who can use the system at the same time and the number of processes (executing programs) that the system can run simultaneously. These criteria lead to three types of operating systems:
Single-user, single-process system: These operating systems allow only one user at a time to use the computer system, and the user can run only one process at a time. Such operating systems are commonly used for PCs. Examples of these operating systems are earlier versions of Mac OS, DOS, and many of Microsoft’s Windows operating systems.
Single-user, multiprocess system: As the name indicates, these operating systems allow only a single user to use the computer system, but the user can run multiple processes simultaneously. These operating systems are also used on PCs. Examples of such operating systems are OS/2, Windows XP Workstation, and batch operating systems. Batch processing is still commonly used in mainframe computers, and most modern operating systems including UNIX, Microsoft Windows, Linux, and Mac OS perform some tasks in batch mode. Even smartphone operating systems including Android and iOS perform tasks in batch mode.
Multiuser, multiprocess system: These operating systems allow multiple users to use a computer system simultaneously, and every user can run multiple processes at the same time. These operating systems are commonly used on computers that support multiple users in organizations such as universities and large businesses. Examples of these operating systems are UNIX, Linux, Windows NT Server, MVS, and VM/CMS.
Multiuser, multiprocess systems are used to increase resource utilization in the computer system by multiplexing expensive resources such as the CPU. This capability leads to increased system throughput (the number of processes finished in unit time). Resource utilization increases because, in a system with several processes, when one process is performing input or output (e.g., reading input from the keyboard, capturing a mouse click, or writing to file on the hard disk), the CPU can be taken away from this process and given to another process—effectively running both processes simultaneously by allowing them both to make progress (one is performing input/output [I/O] and the other is using the CPU). The mechanism of assigning the CPU to another process when the current process is performing I/O is known as multiprogramming. Multiprogramming is the key to all contemporary multiuser, multiprocess operating systems. In a single-process system, when the process using the CPU performs I/O, the CPU sits idle because there is no other process that can use the CPU at the same time.
Operating systems that allow users to interact with their executing programs are known as interactive operating systems, and the ones that do not are called batch operating systems. Batch systems are useful when programs are run without the need for human intervention, such as systems that run payroll programs. The VMS operating system has both interactive and batch interfaces. Almost all well-known contemporary operating systems (UNIX, Linux, DOS, Windows, etc.) are interactive. UNIX and Linux also allow programs to be executed in batch mode, with programs running in the background (see Chapter 10 for details of “background process execution” in UNIX). Multiuser, multiprocess, and interactive oper...

Table of contents

  1. Cover
  2. Half Title
  3. Title Page
  4. Copyright Page
  5. Dedication
  6. Table of Contents
  7. Preface to the Third Edition
  8. Acknowledgments for the Third Edition
  9. Acknowledgments for the Second and First Editions
  10. Personal Acknowledgments
  11. CHAPTER 1 ▪ Overview of Operating Systems
  12. CHAPTER 2 ▪ A “Quick Start” into the UNIX Operating System
  13. CHAPTER 3 ▪ Editing Text Files
  14. CHAPTER 4 ▪ Files and File System Structure
  15. CHAPTER 5 ▪ File Security
  16. CHAPTER 6 ▪ Basic File Processing
  17. CHAPTER 7 ▪ Advanced File Processing
  18. CHAPTER 8 ▪ File Sharing
  19. CHAPTER 9 ▪ Redirection and Piping
  20. CHAPTER 10 ▪ Processes
  21. CHAPTER 11 ▪ Networking and Internetworking
  22. CHAPTER 12 ▪ Introductory Bourne Shell Programming
  23. CHAPTER 13 ▪ Advanced Bourne Shell Programming
  24. CHAPTER 14 ▪ Introductory C Shell Programming
  25. CHAPTER 15 ▪ Advanced C Shell Programming
  26. CHAPTER 16 ▪ Python
  27. CHAPTER 17 ▪ UNIX Tools for Software Development
  28. CHAPTER 18 ▪ System Programming I: File System Management
  29. CHAPTER 19 ▪ System Programming II: Process Management and Signal Processing
  30. CHAPTER 20 ▪ System Programming III: Interprocess Communication
  31. CHAPTER 21 ▪ System Programming IV: Practical Considerations
  32. CHAPTER 22 ▪ UNIX X Window System GUI Basics
  33. CHAPTER 23 ▪ UNIX System Administration Fundamentals
  34. CHAPTER 24 ▪ ZFS Administration and Use
  35. CHAPTER 25 ▪ Virtualization Methodologies
  36. GLOSSARY
  37. INDEX