640 likes | 781 Views
(Lecture 2). OS Concepts Using Linux. CS5002 Operating Systems Dr. Jose M. Garrido. Class Will Start Momentarily…. Operating Systems User Interfaces. Graphics GUI (windows oriented) Command level (shell) At login time, the shell starts computing
E N D
(Lecture 2) OS ConceptsUsing Linux CS5002 Operating SystemsDr. Jose M. Garrido • Class • Will • Start • Momentarily…
Operating Systems User Interfaces • Graphics GUI (windows oriented) • Command level (shell) At login time, the shell starts computing • System calls Invoked from user programs
Multiprogramming - Batch Systems Several jobs are kept in main memory at the same time, and the CPU is multiplexed among them.
OS Features Needed for Multiprogramming • I/O routine supplied by the system. • Memory management – the system must allocate the memory to several jobs. • CPU scheduling – the system must choose among several jobs ready to run. • Allocation of devices.
Time-Sharing Systems • The CPU is multiplexed among several jobs that are kept in memory and on disk (the CPU is allocated to a job only if the job is in memory). • A job is swapped in and out of memory to the disk. • On-line communication between the user and the system is provided; when the operating system finishes the execution of one command, it seeks the next “control statement” not from a card reader, but rather from the user’s keyboard. • On-line system must be available for users to access data and code.
Introducing Unix/Linux • A multi-user OS • Users log on by typing their user names and their passwords • A Multitasking OS • Users can have more than one program executing • A portable OS • Unix runs on a wider variety of different systems than any other OS
Unix Shells • A shell is a Unix program that interprets the commands that users type on their terminal keyboards • Different Unix shells: • Bourne • Korn • C shell • Bash (default on Linux) • tcsh
SSH Utility Program SSH Client for Windows is available free to KSU students and faculty. This program can be downloaded by carrying out the following steps: • Search the Web page: www.kennesaw.edu • Select/click “Computing Resources” • Select “IT Service Desk” • On the left panel, click on n “Software Downloads” • Type your NETID name and password • Click on: SSH.exe to download this install program • After downloading, execute the install program
Using the SSH Utility Two modes of operation are provided by this utility: • Secure File Transfer Client • Secure Shell Client
Connecting The following steps are used to connect to a Linux server with the Secure Shell Client: • Make sure you are connected to Internet • Start ssh (Secure Shell Client) to connect to a remote Unix server • Type cs3.kennesaw.edu • Logon to Linux on the CS3 server • Start using the Linux shell
Connecting to Linux Server After you click on the window or press the Enter key, the following dialog box appears. Type the name of the server, type your user account name, and click on the Connect button.
Loggin In • Type your password on the following dialog box
Basic Unix Commands • For a more complete set of commands Appendix A Important commands: • ls, mkdir, cd, cp, more, rm, pwd, exit • Text editor: pico Start pico and read the help screens
Printing • Normally, every printer connected to a network has a symbolic name • In this course, you will use FTP mode of SSH to transfer (copy) the file you want to print, from CS3 to your local computer (PC) • Print the file from your computer.
Steps to Run a Simulation Model on Linux • Create a working directory for running simulations with the OS models $ mkdir os • Copy to your working directory, the corresponding simulation model (s) and the psim3 script file from the “/home/jgarrido/psim3” directory $ cp /home/jgarrido/psim3/batch.cpp os $ cp /home/jgarrido/psim3/psim3 os
Run a Simulation Model on Linux • Compile and link the simulation model $ ./psim3 batch.cpp • Run the model (output on the screen) $ ./a.out • Run the model, redirect the output to a file $ ./a.out > batch.lst • View the output file $ more batch.lst
Using CS3 • To compile and link the C++ program: $ ./psim3 batch.cpp • To execute the program $ ./a.out
‘ls’ Command • List files and subdirectories in current directory or specified directory $ ls • The long listing is produced with the -l option: $ ls -l $ ls -lt | more
‘man’ Command • To get a short online manual or documentation on the specified command $ man ls (help with ‘ls’) $ man cd (help with ‘cd’) The space key shows the next page
Make and Change Directory • To make a new directory under your current directory: $ mkdir mydir • To change to a directory: $ cd mydir (change to mydir) $ cd os (change to os)
Directories • The system root directory is denoted as a slash (/) • An absolute path denotes the position of a file in the file structure /export/home/jjg/psim/batch.cpp • The current working directory is denoted as dot (.), The parent of the current directory as dotdot (..)
Show Current Working • To display the current working directory: $ pwd • To return to your home directory: $ cd
File Protection - Access Permissions • Types of users for file access: • Owner of the file or directory (user) • Group, users in the same group as the owner • Others, all other users • Types of access permissions • Read (r) • Write (w) • Execute (x)
Change File Access Mode • To change the read access permission to all users for batch.cpp $ chmod a+r batch.cpp $ chmod o-w batch.cpp (remove write permission to others) • When writing a shell script, change execute permission
Unix File Concept • A file is a sequence of bytes • All input/output devices are treated as files • Types of files • simple/ordinary • directory • symbolic link • special (device) • named pipe
Copying Files • The copy (cp) command copies one or more files from a source directory to a destination directory $ cp /home/jjg/psim/batch.lng . • The previous command copied file ‘batch.lng’ located in /home/jjg/psim to your current directory (dot)
Moving Files • The move (mv) command is used to move files from a source directory to a destination directory. • The command is also used to change the name of a file, in the same directory: $ mv batch.cpp batch.txt
Systems and Models • A system is the part of the real world under study. Composed of a set of entities interacting among themselves and with the environment. • A model is an abstract representation of a system. • The system behavior is dependent on the input data and actions from the environment.
Abstraction • The most important concept in analysis and design • A high-level description of a collection of objects • Only the relevant properties and features of the objects are included.
System A system has: • Structure • Behavior The model of a system is simpler than the real system in its structure and behavior. But it should be equivalent to the system.
Using a Model A user must be allowed to: • Manipulate the model by supplying it with a set of inputs • Observe its behavior or output • Predict the behavior of the real system by analyzing the behavior of the model .
Behavior of a Model Depends on: • The passage of time • Input data • Events generated by the environment
Types of Model The most general categories of models are: • Physical models (scale models) • Graphical models • Mathematical models. Mathematical models are the most flexible ones and are the ones studied here.
Solutions to Mathematical Models • Analytic, the solution is a set of expressions that define the behavior of the model. • Numeric, mathematical techniques are used to derive values for the model behavior within given intervals. Deterministic and stochastic models are solved with numerical techniques.
Models with Uncertain Behavior Models are further categorized as: • Deterministic - models that display a completely predictable behavior (with 100% certainty) • Stochastic - models that display some level of uncertainty in their behavior. This random behavior is implemented with random variables.
Stochastic Models • A stochastic model is one which includes some uncertainty in its behavior. • One or more attributes change value according to some probability distribution. Random number generation is used. • For example, in the simple batch OS model: • arrival of jobs • service time for a job
Simulation • A simulation model is a mathematical model implemented with a general-purpose programming language, or a simulation language. • A simulation run is an experiment carried out for some observation period and with the simulation model to study the behavior of the model.
Continuous and Discrete Models • Continuous models change their state continuously with time. Mathematical notation is used to completely define the behavior. For example, the free-falling object. • Discrete models only change their state at discrete instants. For example, arrival of a job in the Simple batch OS model.
Discrete-Event Simulation • Event approach • Activity approach • Process interaction approach • Psim and PsimL uses the full power of process interaction simulation. • GPSS has limited support • Simscript has limited support • Modsim III has good support
Simulation Results For every simulation run there are two types of output: • Trace - sequence of events that occur during the simulation period • Performance measures - summary statistics about the simulation.
Performance Measures • Throughput • Capacity • Response time • Utilization • Reliability • Speedup • Backlog
Workload on a System • The performance measures depend on the current workload of the system • The workload for a system can be characterized by another series of measures, which are made on the input to the system • Errors in characterizing the workload may have serious consequences
Workload Parameters • Interarrival time • Task size • I/O request rate • I/O service rate • Memory size • Task mix • Parallelism