Download presentation
Presentation is loading. Please wait.
Published byColin Ramsey Modified over 9 years ago
1
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The Operating System Allocates memory for the program and loads the program in it. It also loads the CPU registers with control information. The registers maintain the memory locations where each segment of a program is stored. The instructions provided in the program are executed by the CPU. The OS keeps track of the instruction that was last executed. This enables it to resume a program if it had to be taken out of the CPU before it completed execution.
2
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The Operating System If program needs to access hardware, it makes a call to the OS; for example for file I/O, the OS directs the disk controller to open the file and make the disk available to the program. After the program has completed execution, the operating system cleans up the memory and registers and makes them available for the next program. Modern OS are multiprogramming; however, computers with single CPU, only one program can run at one time.
3
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The Operating System The OS generally allows a program to run for an instant, saves its state, and then loads next program in the queue. The OS creates a process for each program and controls switching of these processes. Programs often access disk I/O, these operations keep the CPU idle; so the OS takes the program out of CPU while the I/O operation is in progress and schedules another program to run. It provides maximum utilization of the CPU.
4
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Operating System Many (proprietary) operating systems in the past, one from each hardware vendor written in a near-machine language known as assembler.
5
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Operating System Written in C not assembler. C is high level with portability considerations in mind. For programmers, UNIX offers a rich set of programming tools to aid in developing, debugging, and maintaining programs. One of these program is the system command’s interpreter, called the shell Interaction with UNIX system through the shell.
6
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Operating System A command may already exist on the system or written by you. Power of UNIX lies in combining these commands similar to the English language. UNIX was written by programmers for their own use, so things may not always appear obvious to you.
7
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Knowing your Machine UNIX can used by many users concurrently A terminal emulation facility running on a PC or workstation allows the PC to behave like a dumb terminal. Functions of many of keys change when the same PC doubles as UNIX box.
8
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The System administrator On a large system serving hundreds of users, someone has to be in-charge of administering the system. Responsible for the management of the entire setup, allocating user accounts, maintain file systems, taking backups, managing disk space, and perform several other important functions. If you run some flavor of UNIX on your machine, then you are probably its administrator.
9
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Logging In and Out The good old dumb terminal connected to the serial port was the way to connect to UNIX. Later Terminal programs became popular. For security reasons, SSH could be the only means of connecting to the remote UNIX box. UNIX users may use Putty or any of the free SSH programs available on the Net.
10
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. A Hands-On Session UNIX is case sensitive; and commands are generally in lowercase; unlike DOS both date and DATE will work $DATE (ksh: DATE: not found) Every UNIX system maintains an internal clock; you can access it with a single command named date: $date (Mon Jan 14 19:31:56 GMT 2008) View the list of current users with the who command $ who
11
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. A Hands-On Session Viewing Process with ps $ ps The last columns in the ps command shows the process named bash (Bash shell); other possible shells are ksh (Korn shell), sh (primitive Bourne shell), csh (C shell) $ echo $SHELL (/usr/bin/ksh) Handling Files – several ways to create a file echo date > foo Display file with cat cat foo
12
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. A Hands-On Session Copying a file with cp - $ cp foo foo.sh Display list of files with command $ ls Rename a file with $ mv Removing the file with $ rm Handling directories Create a directory with $ mkdir try $ ls -F Directory navigation pwd cd Remove directory $ rmdir try $ sh foo? What happens
13
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. POSIX and the single UNIX specification Dennis Ritchie’s decision to write UNIX in C – not portable; also the absence of a single conforming standard adversely affected the development of portable applications. AT&T created the “System V interface Definition” (SVID) Later the X/Open (now the Open group), a consortium of vendors and users created X/Open Portability Guide (XPG) The Portable Operating System Interface for Computer Environment (POSIX) was developed – refers to OS in general, but was based on UNIX
14
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Linux and GNU Linux – the free UNIX Free Software Foundation (formerly known as GNU – the recursive acronym that stands for “GNU’s Not Unix!”).
15
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture Division of Labor - two agencies kernel shell
16
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture The kernel interacts with the machine’s ________ it is the core of the _______ gets loaded into memory at _______ ________ comprises of set of routines (written in C) to communicate with the _________ directly. User’s applications communicate with the kernel via _____ _____ in order to access the _______ manages system memory schedule processes decides priorities for the ________ and performs other miscellaneous tasks
17
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture The shell the outer part of the ________ ________ an interpreter responsible for ________ user commands into action an interface between the user and the _______ one kernel – several shells (for each user who is logged in) examines the keyboard input (command) for special characters prior to communicating with the ________
18
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture The File and Process Files have ________ Processes have _______ Files Files are containers Files are static Directories and devices are also files Files are related to other files by being a part of single hierarchical structure called _____ ______
19
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture Process A program in execution Dynamic – resembles living organisms (born and die) also forms hierarchy – when a process is a child of another process UNIX provides tools to control processes move them between foreground and background or kill them
20
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture The System Calls UNIX System kernel, shell, applications – written in C kernel offers services such as disk I/O operations programs access these kernel services by invoking special functions called ______ ______ C programmers can not use “write” system call on Windows system; instead Windows system use the standard library functions for everything; for example fprintf In UNIX, users have access to both write and fprintf in a C program meant to run a UNIX machine write – a system call fprintf – library function
21
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. The UNIX Architecture POSIX ____ _____ ____ ____ for ______ ______ specifies the system calls that all UNIX systems must implement
22
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Features of UNIX A multiuser system UNIX is a multiprogramming system it permits multiple programs to remain in memory and compete for CPU These programs can be run by different users – multiuser Windows - single user system CPU, memory and hard disk; all dedicated to a single user kernel uses the principle of time sharing A multitasking system UNIX is a multitasking system user can edit a file, print another one, send email to a friend, and browse WWW – without leaving any of the applications
23
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Features of UNIX users can see one job running in the foreground; the rest run in the background you can switch jobs between foreground and background, suspend or terminate as a programmer, edit the C program with the vi editor and then suspend the vi process to run the cc compiler; there is no need to quit vi Repository of Applications kernel can not do everything for the users host of applications shipped with UNIX system new tools are being added
24
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Features of UNIX The Building block A complex task can be broken into finite number of simple ones shell offers a mechanism called the pipe that allows the output of one command to server as input to another that is why who output does not include a header; in case you needed to count the number of users by supplying the output to a word counting program
25
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Features of UNIX Pattern Matching UNIX features many sophisticated pattern matching features For example, all C programs have the.c extension, and to use the tar command, we can just use a pattern *.c to back them to tape * - referred to as a metacharacter printf.*name – a regular expression to match all lines containing both printf and name
26
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. Features of UNIX Programming Facility The UNIX shell is also a programming language it has control structures and variables These features are used to design shell scripts programs that run UNIX commands in a batch Documentation UNIX documentation is no longer a sore point The online help facility – man commands A vast ocean of UNIX resources is available on the Internet
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.