What is your favorite computer operating system

The commands here are "machine commands", that is, bit chains that cause processor actions. More will be said about this later in.

Transcript

1 1 of: 59 Computers und Physik, version dated: 37: Operating system Internal representation: data and commands Tasks of the operating system Examples Internal representation of data and commands All information in a computer is actually data - programs as chains of commands can also be referred to as data become. All data is ultimately represented by bits. Conventions were agreed upon, one of which is the representation of (predominantly print) characters in ASCII (American Standard Code for Information Interchange), in which characters are assigned to decimal numbers from 0 to 127 (the 7-bit numbers of) are: ASCII table In today's processors and memories, 8 bits are usually combined into one byte and these bytes are addressed by address in the memory. So if you want to read a bit, you get the whole byte in which the bit is located. Depending on the architecture of the computer, several bytes may also be combined. The commands here are "machine commands", that is, bit chains that cause processor actions. More will be said about this later in. Machine languages ​​and assembler In fact, the number only differs from the correct answer in the seventh decimal place. Nevertheless, in some cases it can be undesirable for a computer to notify that the company has employees. (Kronecker once said: "God created the whole numbers. Everything else is human work.") This is the reason to introduce whole numbers as a separate data type and to treat them appropriately so that such problems do not arise. With the numbers, the form of the representation depends on the desired length of the bit string. The usual standard length is 4 bytes = 32 bits. In this case, an integer number is represented by a sign bit (the bit on the far left) and 31 mantissa bits (the actual numerical value). The binary form is shown for positive numbers, the binary complement (0 replaced by 1 and vice versa) of (number - 1) (= binary compliment + 1) for negative numbers. The decimal number then corresponds to 14 and the number (-1 corresponds to). The reason for this unusual representation of negative numbers is that in this form one simply has to add the negative numbers to other numbers and discard the overflowing bits (left). The result is always correct (try that with the two numbers 14 and -14!). The range of values ​​for 32-bit integers A is thus. There are also standards for the internal representation of floating point numbers. The best known is that of the Institute of Electrical and Electronic Engineers, Inc .: IEEE Standards Association. You can usually find the internal representation in the documentation of

2 2 of: 59 Operating system and / or compilers (manuals). With a 32-bit representation of a floating point number, 1 bit is reserved for the sign, 24 bits for the mantissa and the remaining 7 bits for the exponent. This means that positive and negative numbers in the range from to can be displayed. Since only 42 bits are reserved for the mantissa, the number of decimal places given in this way is about 6 decimal places and the exponent in the decimal system can be between -37 and 38. If you want to calculate more precisely, use larger or smaller numbers, you have to provide more bytes ("double precision" etc.). Task: Compare the internal representation of characters and numbers in different systems (Linux / C, Linux / g77, ...). To do this, you need an auxiliary program that appropriately specifies the content of individual bytes. Under UNIX this is "od" (octal dump), but you can also write a C, Pascal or Fortran program for it yourself. Exercise A1 Exercise A2 Exercise A3 Exercise A4 The ASCII character set defines a 1: 1 mapping of 7-bit (1 byte) values ​​to print and control characters: octal: 000 nul 001 soh 002 stx 003 etx 004 eot 005 enq 006 ack 007 bel 010 bs 011 ht 012 nl 013 vt 014 np 015 cr 016 so 017 si 020 dle 021 dc1 022 dc2 023 dc3 024 dc4 025 nak 026 syn 027 etb 030 can 031 em 032 sub 033 esc 034 fs 035 gs 036 rs 037 us 040 sp 041! 042 "043 # 044 $ 045% 046 & 047 '050 (051) 052 *, /: 073; 074 <075 = 076> 077? 101 A 102 B 103 C 104 D 105 E 106 F 107 G 110 H 111 I 112 J 113 K 114 L 115 M 116 N 117 O 120 P 121 Q 122 R 123 S 124 T 125 U 126 V 127 W 130 X 131 Y 132 Z 133 [134 \ 135] 136 ^ 137 _ 140 `141 a 142 b 143 c 144 d 145 e 146 f 147 g 150 h 151 i 152 j 153 k 154 l 155 m 156 n 157 o 160 p 161 q 162 r 163 s 164 t 165 u 166 v 167 w 170 x 171 y 172 z 173 {} 176 ~ 177 del hexadecimal: 00 nul 01 soh 02 stx 03 etx 04 eot 05 enq 06 ack 07 bel 08 bs 09 ht 0a nl 0b vt 0c np 0d cr 0e so 0f si 10 dle 11 dc1 12 dc2 13 dc3 14 dc4 15 nak 16 syn 17 etb 18 can 19 em 1a sub 1b esc 1c fs 1d gs 1e rs 1f us 20 sp 21! 22 "23 # 24 $ 25% 26 & 27 '28 (29) 2a * 2b + 2c, 2d - 2e. 2f / a: 3b; 3c <3d = 3e> 3f? 41 A 42 B 43 C 44 D 45 E 46 F 47 G 48 H 49 I 4a J 4b K 4c L 4d M 4e N 4f O 50 P 51 Q 52 R 53 S 54 T 55 U 56 V 57 W 58 X 59 Y 5a Z 5b [5c \ 5d] 5e ^ 5f _ 60 `61 a 62 b 63 c 64 d 65 e 66 f 67 g 68 h 69 i 6a j 6b k 6c l 6d m 6e n 6f o 70 p 71 q 72 r 73 s 74 t 75 u 76 v 77 w

3 3 of: 59 78 x 79 y 7a z 7b {7c 7d} 7e ~ 7f del decimal: 0 nul 1 soh 2 stx 3 etx 4 eot 5 enq 6 ack 7 bel 8 bs 9 ht 10 nl 11 vt 12 np 13 cr 14 so 15 si 16 dle 17 dc1 18 dc2 19 dc3 20 dc4 21 nak 22 syn 23 etb 24 can 25 em 26 sub 27 esc 28 fs 29 gs 30 rs 31 us 32 sp 33! 34 "35 # 36 $ 37% 38 & 39 '40 (41) 42 *, /: 59; 60 <61 = 62> 63? 65 A 66 B 67 C 68 D 69 E 70 F 71 G 72 H 73 I 74 J 75 K 76 L 77 M 78 N 79 O 80 P 81 Q 82 R 83 S 84 T 85 U 86 V 87 W 88 X 89 Y 90 Z 91 [92 \ 93] 94 ^ 95 _ 96 `97 a 98 b 99 c 100 d 101 e 102 f 103 g 104 h 105 i 106 j 107 k 108 l 109 m 110 n 111 o 112 p 113 q 114 r 115 s 116 t 117 u 118 v 119 w 120 x 121 y 122 z 123 {} 126 ~ 127 del Tasks of the operating system When you turn on your computer, you get some cryptic lines of information and after some time a (hopefully) nice user interface with the request to enter your name and password. What was the function of this? Even more elementary, who or what is Responsible for reacting to your keyboard input or mouse movements? Who or what is responsible for displaying images and text on the screen? All these are functions of a program package called the operating system. There are different operating systems, originally for everyone The manufacturer "built" a new operating system for the new type of computer. In the first decades of computer use (until the mid-17s), the "user interface" of the operating systems was still exclusively text-oriented. Both have changed a lot. Today there are only a few fundamentally different operating systems (UNIX and MS-Windows), and a number of user interfaces or variants "based on them". What are the tasks of an operating system: Initialization and recovery control, input / output, "file access" Memory management, file management Regulation of program processes Various goodies (a) Initialization and recovery Baron von Münchhausen, who was once on his shoelaces (for our German Friends: shoelaces, English "bootstraps") pulled out of the swamp. (At least that's what he said.) When you supply power to the computer, it starts at a fixed address (in the so-called ROM - read only memory, which is often an EEPROM) and executes the commands given there. These in turn fetch a somewhat larger mini-program from somewhere (floppy disk, CD, hard disk or network), which then takes a closer look at the system (the hardware) and copies ("loads") another program, the so-called kernel, into the main memory of the processor. . The kernel is the core of the entire operating system, it starts all other necessary system programs, in short "the system". Ready to go! This pulling up from small to small programs to the whole program has been given the name "Bootstrap". Another function of the operating system is the reverse process (shutdown, error recovery or reset). In all these cases, the processor addresses a defined address in the base part of the system program, where the commands are then which are intended to ensure an orderly shutdown or restart. Even if the current drops, it happens in 1/50 of a second, that's enough for many commands and processes so that too much crap is not "built". (b) Control, input / output, "file access" This includes numerous tasks that affect communication with "the rest of the world" (i.e. outside the processor): opening and closing files ("files") and devices ("device files") ") Intermediate storage (buffering) of data until forwarding

4 4 of: 59 Interrupt handling (if you press a key on the keyboard, for example, a special "Interrupt" signal is sent to the processor, which must then react appropriately; this is also the case with all other external devices) Network communication : actually communication with the network card; the tasks are precisely divided. (c) Memory management, file management This includes organization of the file system (folder structure: accounting and organization) Monitoring of the memory (memory) Program management ("swap") (d) Regulation of program processes Originally there were so-called "single-user" systems where only one Process (program) ran uninterrupted until control was passed to another program (other process), and so on. Since the introduction of UNIX at the latest, there has been the concept of numerous "simultaneously running" processes, i.e. a "multi-user" system. However, this is not always really "parallel". In practice, you usually only have one processor available, which means that only one process can run at the same time. The solution is called "timeslicing". The time is broken down into small slices and all "parallel" processes are given control in turn for one time slice each. If the time slices are short enough, it is almost "parallel". Only if you have several processors in the computer is there real parallelism. Fast single processors and good operating systems hardly show any difference. The "programs" that are started under the operating system can of course be very large (applications such as Mathematica, Photoshop and so on) and even "emulate" other operating systems themselves. It can be compilers that translate your programs into machine code, and it can be your own programs. All of these benefit from the various functions of the operating system. Task: Look at your favorite computer to see how many processes are running "simultaneously" (MS Windows: Task Manager; UNIX: command "ps -aux" or "ps -defl" depending on the UNIV derivative). Other important terms are: batch mode: Programs are executed one after the other depending on the CPU availability (e.g. at night or when nothing else is going on). A "batch spooler" and "job scheduler" take care of the process. The "accounting system" takes care of the calculation of the resources used. "Spooling" of print jobs (print queues) is part of this area of ​​responsibility. interactive mode: This is the normal state when you are sitting at the computer and there is a very quick reaction to every input you make. This is also called "online", "demand mode" or "time sharing" (the latter especially when you are connected to a computer via a terminal on which several other users are also working at the same time). real time mode: This is a reaction in real time, i.e. immediately (really immediately, immediately, IMMEDIATELY!). This mode is primarily used to control systems in which it is important that the reaction really takes place immediately (i.e. immediately following the interrupt). It would be kind of embarrassing if an airplane (fly by wire) did not react to the movement of the control stick until after a pause for reflection, because the processor might be busy sorting through a list of the available videos. (e) Various goodies What is practical: display of the processor load, time information, graphic aids, and and and ... Many of these functions are available in the operating systems to make life easier for the application programs. Further information: From time to time I give the Unix and Internet lecture, where there is more information about the topics discussed. Another link: Linux: A Brief Introduction (Linux = Public Domain Unix). Exercise A1 Exercise A2 Exercise A3 Exercise A4 Exercise A5 Exercise A Examples In the lecture I mentioned UNIX (today mainly in the Linux variant) and DOS as examples for command language-oriented operating systems. First there are links to the history and the properties of these operating systems: Computer History UNIX: Historical overview and terms DOS: Historical overview and terms In addition, there is now a graphical user interface. In the UNIX / Linux area this is practically exclusively implemented using X11 standards (see also X Windows consortion. Various desktop interfaces (window managers such as KDE or Gnome in the Linux area) are then based on this.

5 5 of: 59 The Windows system from Microsoft links the window manager with the underlying system so strongly that it is hardly visible to the user. As you know, there are processes for access and documentation of the operating system behind the user interface, which is not UNIX. Computer History: Windows And finally there is also the Apple operating system (currently "MAC-OS"). It is the successor to what was perhaps the most successful desktop system (i.e. graphical interface to the operating system) of all in the 1980s. Years of disputes between Microsoft and Apple document the heated battle for the originality of desktop ideas a UNIX: Historical overview and terms UNIX was created by D.M. Richie and K. Thompson created the first interactive operating system at AT&T Bell Labs in 1969 (they called it "Unics"). It was initially written in assembler for a PDP-7, but was soon rewritten in a specially created high-level language, namely C. The rapid spread of UNIX, first of all in the USA, has several causes. First, the compactness and structural simplicity of UNIX; the core consists of only approx. lines of program, of which only around 2000 are machine-dependent and have to be written in assembler. Second, it was given to universities by Bell for free. At the universities, especially at the University of California at Berkeley, it was then considerably expanded and further spread in the university market. Third, it offered many computer manufacturers the opportunity to develop new hardware cheaply without having to invent their own operating system. Bell or AT&T did not market UNIX until 1983, only protected the brand name. Therefore, all computer manufacturers who carried UNIX over to their machines had to invent their own names for it. The GNU project ("Gnu is Not Unix") was started in 1984 with the aim of developing a UNIX operating system as "free software". Linux is part of this effort, but there are many others such as X-Windows Toolkits. Linus Thorvalds wrote an implementation of UNIX for PCs in 1991: Linux. This is so-called freeware (not to be confused with shareware or public domain software), so it can be used without license fees. Since it is an open system (the source code can be viewed by everyone), many volunteers have continued to work on the further development of modules and programs for Linux. The 2.4.x kernel version is currently (2001) available. To make installation easier, some software producers (e.g. SUSE in Germany or Redhat in the USA) have put together suitable packages for the Linux kernel, which are available via the Internet and CDs for a low price. Linux is now so widespread that even the large workstation manufacturers often offer Linux adaptations for their devices. Examples of the different names behind which UNIX systems stand: System name BSD HP-UX AIX XENIX ULTRIX Solaris (formerly: SUN-OS) IRIX LINUX manufacturer or system house University of California at Berkeley Hewlett Packard IBM Microsoft Corp. DEC SUN SGI Linus Thorvalds (UNIX for PCs) Fig. 2.1 shows the development graphically. Of course, every manufacturer has changed, added, left out, etc. different things. Here is a rough overview of the historical development, which makes the connections between the different UNIX versions clear.

6 6 of: 59 Fig 2.1 .: Development of UNIX Agreements and agreements of all major manufacturers led to a convergence in development. Although the Berkeley-BSD-UNIX was widespread, especially at universities, there is still a standardization towards UNIX System V. The most common version System V Release 4 (SVR4) comes from Unix System Laboratories (then part of AT \ & T) and Sun Microsystems and combines the properties of BSD and System V. This variant is also represented on the SGI workstations in the Institute for Theoretical Physics. The differences to BSD are small, however, and are mostly limited to options for a few commands. In this text we will mostly explain the SystemV variant of the commands and options, but we will point this out in the case of important deviations (for example to the BSD-like Linux commands). Linux has elements of System V and BSD 4.3 and is compatible with SVR4 and earlier BSD versions. It is freely available to the public. It is distributed under the so-called "GNU General Public License", so it may be copied and distributed including the source code. Changes and extensions to the code are permitted, provided that the result is also subject to the GPL.While workstations are still mostly installed with company-specific adaptations of UNIX, UNIX installations on PCs are practically exclusively Linux. Thanks to the software freeware philosophy, countless private software developers have contributed (and still do) to Linux extensions. In the future, we will practically always use the generic term UNIX here (except when it comes to exceptions). What distinguishes UNIX? Multi-process operating system and timeshare: the parallel execution of different tasks is practically built-in; de facto, of course, on computers with only one processor, the time "slices" are broken down and assigned to the subtasks. However, since these slices are very small, the impression of real parallelism is created, although the individual processes often have to wait for each other. Largely device-independent, hierarchical, uniform file concept: Each process (each program) receives data from one or more files and writes data to files. These files can actually be storage media, but also input or output devices such as a keyboard, screen or telephone modem. Availability: on most platforms, from PCs (Linux) to mainframes. Powerful command language: line-oriented and dialog-oriented language with filter and assembly line technology; graphical interfaces execute scripts in UNIX or other languages. Disadvantages of UNIX in the standard version: no real-time operating system: only conditionally suitable for process control. no assuring file access procedures for dangerous commands; the user must ensure this. Partly bad mnemonics of the command names. Sparse error messages. Security problems: Low protection against incorrect operation or unauthorized access to system files; the sysadmin can set up improvements by taking appropriate actions. The so-called X / OPEN consortium specifies standards which operating systems that want to bear the name UNIX must meet. In or in addition to UNIX, a number of standards have emerged which relate to extensions of the UNIX operating system, in particular for graphic user interfaces and computer networks. Examples: Screen control: X-Windows (X11-R6): The X protocol, developed in the mid-80s, makes it possible to address graphic (screen) surfaces over the network. OSF / Motif (Graphical User Interface based on X Windows) Communication between computers: TCP / IP: The Transmission Control Protocol / Internet Protocol is a (software) communication standard, comparable to the old XON / XOFF protocols of the RS-232 interfaces . It is mostly implemented on the basis of Ethernet, but in principle does not depend on the hardware properties of the network. It is included in the standard scope of delivery of a UNIX system and is therefore very common.

7 7 of: 59 Common file systems over the network: Network File System: The NFS (developed by SUN) enables the common use of mass storage and resources from different computers from different manufacturers. In the university area, practically all PCs and workstations are connected to a shared Ethernet and thus to each other and to the computers of the ZID of the KFU via the TCP / IP protocol. Many of our examples are taken from the SGI area of ​​theoretical physics, as are the internet addresses given. If interested parties not working here use these documents, they are asked to modify the addresses accordingly (so do not try to use our name servers and mail servers from outside the Karl-Franzens-Universität Graz!). The Internet - nowadays often incorrectly used synonymously with the WWW (World Wide Web) - is the connection between computers. Thanks to standardized transmission protocols (the most common under UNIX is TCP / IP), practically every computer connected to the Internet can communicate with every other computer connected in this way. Different standards are of course necessary for this: Hardware standards define the way in which data bits are transmitted via different channels (telephone connections, Ethernet, fiber optics, radio connections, etc.). Communication standards describe how the data packets are structured, how the addresses, the content and other information are specified in the data packet and how these packets are forwarded from the end computer via the node computer. Software standards describe how these packets are assigned and transmitted to individual processes by the operating system of the computers involved. The Internet was developed in the US since the 1970s in the military sector (ARPANet) and then opened to the economic and academic sectors in the 1980s. Of course, parts of the network (for example within a company) can work separately from the rest of the world (so-called intranets). The separation can take place logically (different addresses) or also physically (separate lines); the second variant is of course the safer one if you want to avoid illegal access. As part of the TCP / IP protocol, numerous functions such as file transfer are provided for data transmission. The WWW (World Wide Web) is a special sub-protocol that was developed by Tim Berners-Lee at CERN around 1990 to enable multimedia communication between employees of the large experimental physicist groups. Thanks to its flexibility, it quickly opened up the general "market" and is therefore mostly identified with the Internet itself b DOS: Historical overview DOS stands for "Disk Operating System" and is known in the Microsoft ("MS-DOS") variants The system is a line-oriented command interpreter. MS-DOS 1.0 was released to IBM in 1981; the last version is MS-DOS 6.22 (1994). The interpreter is actually rarely used today, but part of the command set can still be executed under the systems Windows 95/98 / ME (Start / Run) and Windows NT2000 / XP (command or cmd). UNIX was known for a good decade before DOS appeared and so it is not surprising that DOS is a kind of stripped-down UNIX command language. You can also find a good overview in: Computer Software: DOS