Job Control POSIX Commands Signals and IPC Shell Programming Processes Files and File Permissions Open Protocols and Open Standards Contents Operating System Types Open Protocols and Open Standards OSSI — ver. 1.1 Operating System Types OSSI — ver. 1.1 IBM sell many mainframes very large, reliable, expensive computers with high input, output capability Run many virtual machines on the one physical machine Each virtual machine is isolated from the others, so virtual machines can be set up on the one mainframe for two companies that are competitors No company can directly find out what is on the other virtual machines One mainframe can replace many smaller servers in a data centre. OSSI — ver. 1.1 Job Control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 21 POSIX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 11 Why mainframe better than servers? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 7 Virtual Machine Signals and IPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 19 Shell Programming. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 9 Processes and Threads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 17 Virtual Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 6 Permissions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 15 find, xargs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 13 diff. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 12 Four Structures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 5 Summary of the Subject - p. 2/21 Summary of the Subject - p. 4/21 Summary of the Subject - p. 6/21 Open Standards do not limit access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Slide 3 Summary of the Subject Nick Urbanik nicku@vtc.edu.hk Department of Information and Communications Technology Copyright Conditions: Open Publication License (see http://www.opencontent.org/openpub/) OSSI — ver. 1.1 Summary of the Subject - p. 1/21 Open Standards do not limit access Data encoded in a proprietary format may be expensive to recover far into the future Legal restrictions imposed by patents may require additional royalties to be paid in addition to the costs of reverse-engineering. See the updated notes on Free Software and Open Standards. OSSI — ver. 1.1 Summary of the Subject - p. 3/21 Four Structures We covered four OS structures: Monolithic Layered Microkernel Virtual Machine Monolithic OS: examples: Linux, some Unix systems. All kernel code executes in the same address space—low communication overhead Layered Attempts to isolate parts of OS from each other to make the system more modular; has increased overhead of communication between the layers Microkernel tries to make the OS kernel as small as possible. Overhead of communication between the many simple components makes it hard for anyone to understand the system. OSSI — ver. Make sure1.1you know what a system call and a Summary of theare.- p. 5/21 trap Subject Why mainframe better than servers? A company can choose whether to pay for a single mainframe or a number of separate server machines to provide their network services The mainframe may cost less than an equivalent number of individual servers because: The load can be shared among all the virtual machines, and the mainframe CPU can be used effectively Individual servers need to have enough CPU processing power to meet peak demand, but normal traffic will be much less than the peak. Because of this, the individual servers will have a lot of unused processing power. The mainframe will use much less floor space, and so save money OSSI — ver. 1.1 The mainframe will use much less electricity Summary of the Subject - p. 7/21 than the individual servers The mainframe will use much less air conditioning power, and save a lot of electricity. Shell Programming Make sure you understand what you are doing in the shell assignment. Understand how to use the keychain program with your assignment. Note: I have updated the pages about keychain in the notes in Module 13. Shell Programming OSSI — ver. 1.1 Summary of the Subject - p. 8/21 OSSI — ver. 1.1 Summary of the Subject - p. 9/21 POSIX POSIX is a standard, which defines a standard set of system calls, a standard set of commands, and a standard shell programming language. Linux aims to be compliant with the POSIX standards. Many Unix systems are POSIX compliant. POSIX Commands OSSI — ver. 1.1 Summary of the Subject - p. 10/21 OSSI — ver. 1.1 Summary of the Subject - p. 11/21 diff Often used like this: $ diff -u orignal file new file Output of the diff command shows the differences between two sets of files. Output is per line: if a line in original file is not in new file , the output will have a ‘-’ at the start of the line. if a line in original file is in new file , but not original file , the output will have a ‘+’ at the start of the line. if a line has changed, even by one character, the line from original file will have a ‘-’ in the output, while the line from new file will have a ‘+’. Two or so lines are shown around the changes, so that it is easy to see where the change is. These context lines do not have any a ‘+’ or ‘-’ in front, but a space ’ OSSI — ver. 1.1 Summary of the Subject - p. 12/21 ’ instead. find, xargs These two tools often are used go together. Make sure you understand how xargs works. find uses logic expressions to find files that match particular requirements. grep used to search for strings in files . . . and also in standard output. OSSI — ver. 1.1 Summary of the Subject - p. 13/21 File Permissions and Symbolic Links Make sure that you have worked though and understood all the problems in the Permissions Tutorial http://ictlab.tyict.vtc.edu.hk/ossi/lab/ permissions/permissions.pdf We have covered permissions in more detail than in previous years, and permissions are a vital topic in managing POSIX systems. We also spent some time studying symbolic links Make sure you understand clearly the difference between a relative symbolic link and an absolute symbolic link Make sure you understand how to create them from any directory. Please study the handout about symbolic links http://ictlab.tyict.vtc.edu.hk/ossi/lab/ OSSI — ver. 1.1 Summary of the Subject - p. 15/21 sym-link/sym-link.pdf Files and File Permissions OSSI — ver. 1.1 Summary of the Subject - p. 14/21 Processes and Threads Processes have a Process Control Block (PCB) A PCB is one entry in the process table In Linux, it is called task_struct. Some people call it a task descriptor A PCB holds a lot of information, including: The Process ID, (PID), PID of parent (PPID) various User IDs, (UIDs), group IDs (GIDs) An environment (containing environment variables such as PATH A copy of the CPU registers the last time the process was suspended, including a copy of the program counter. The process state (see the two diagrams of process state) Address mapping details OSSI — ver. 1.1 Summary the Subject Resources held by the process, such as a list of offiles - p. 17/21 the process has open Processes OSSI — ver. 1.1 Summary of the Subject - p. 16/21 Signals and IPC Signals and IPC How Processes can Talk to Each Other OSSI — ver. 1.1 Summary of the Subject - p. 18/21 Job Control Processes cannot easily share information Need to use Inter Process Communication (IPC) for two processes to share data. Examples: Pipes — you used in shell programming Sockets — over a network (e.g., for the Internet), and through a socket file — the ssh-agent talks to ssh, scp and other SSH clients through a socket Signals — See the assignment and the trapall shell script Signal is sent by the kill() system call The kill shell command also makes the kill() system call A process often terminates when it recieves a signal OSSI — ver. can trap a signal by executing some code Subject - p. 19/21 Summary of the A process1.1 when it recieves the signal No process can ignore or trap the KILL signal or the STOP signal.  Make sure you understand signals.¨ We stop a process with  Control-Z © This sends a STOP signal to the process. A stopped process is forced to stop executing, but is still using memory and holding resources and file locks, that it was holding when you sent it the STOP signal. Understand what fg, bg, jobs do. Read about this again in module 2. Job Control OSSI — ver. 1.1 Summary of the Subject - p. 20/21 OSSI — ver. 1.1 Summary of the Subject - p. 21/21