Interfaces - www.gregvogl.net

Download Report

Transcript Interfaces - www.gregvogl.net

User Interfaces
Operating Systems
Lecture 2, 20 March 2003
Mr. Greg Vogl
Uganda Martyrs University
Overview
 System calls

Required to interact with hardware
 Command language


Enter commands through terminal or shell
Can be used to create batch files or shell scripts
 Job Control Language (JCL)

Submitting batches to mainframe
 Graphical User Interface (GUI)

windows, menus, icons, pointing device
20 March 2003
Operating Systems: User Interfaces
2
System Calls
 Similar to ordinary library function calls
 Target of function call is system code

part of OS rather than part of calling program
 Higher level calls are APIs



call lower level system functions
used to develop programs for the target OS
Windows NT has high security; only offers APIs
20 March 2003
Operating Systems: User Interfaces
3
UNIX system calls: file I/O
 Creat: creates a file
 Open: opens a file for read/write etc.
 Read: reads bytes from file into buffer
 Write: writes bytes to file into buffer
 Close: frees file from use by the process
 Lseek: moves to file position
 Link: creates another name for the file
20 March 2003
Operating Systems: User Interfaces
4
UNIX system calls: processes






Fork: creates copy of current process
Exec: replaces current process with new one
Exit: terminates process, returns to parent
Kill: sends software signal to terminate process
Pause: suspends execution of a process
Signal: control signals using specified function
20 March 2003
Operating Systems: User Interfaces
5
DOS Software Interrupts
 Interrupt vector table in first 1K of memory
 Interrupts processor like hardware interrupts
 Each vector has some system functions
 Interrupt 21H has many functions for:

Character I/O, file/directory, process and
memory management, date/time, etc.
20 March 2003
Operating Systems: User Interfaces
6
Command Languages
 Used for on-line but also batch processing
 Used to start programs
 Also used to modify user environment

prompt, path, working directory, etc.
20 March 2003
Operating Systems: User Interfaces
7
UNIX commands
 command-name options arguments #comment



0 or more options beginning with dashes (-)
0 or more arguments are often file names
Comment is ignored, used for documenting
scripts
20 March 2003
Operating Systems: User Interfaces
8
UNIX shell scripting
 shell script

commands saved in a file and run as a program
 programming-language features

variables, functions, if, case, for/while loops, etc.
 different shell languages have differing
features

sh, csh, ksh, bash, etc.
20 March 2003
Operating Systems: User Interfaces
9
UNIX file/folder commands
 pwd
 ls
 cd
 cat
 cp
 mv
 rm
20 March 2003
show current directory
lists files in current directory
change to a different directory
display file contents
copy file
move or rename file
delete file
Operating Systems: User Interfaces
10
Other UNIX commands









wc
sort
grep
find
date
echo
who
man
exit
20 March 2003
count characters, words, lines
sort lines of a file
search for a pattern in file lines
search for files with a given name/pattern
show date and time
repeat a line of text
display users logged on the system
display documentation about a command
close the shell (logout if the only shell)
Operating Systems: User Interfaces
11
Perl
 Text processing language
 Combines features of C, UNIX shells, etc.
 Often used to make programmed Web pages
 Can be used for system administration tasks
20 March 2003
Operating Systems: User Interfaces
12
MS-DOS




Similar to UNIX but simpler (e.g. only one user)
UNIX-like directory structure
Batch files (.bat extension)
command-name options arguments

Options begin with forward slashes (/)
 Command.com


Interprets “internal” DOS commands
like UNIX shell
 External DOS commands are separate programs

stored in folder c:\windows\command in Windows 98
20 March 2003
Operating Systems: User Interfaces
13
Internal DOS commands









CD
DIR
TYPE
DEL
COPY
TIME
DATE
CLS
SET
20 March 2003
change or display the working folder
display contents of folder
display contents of file
delete file
copy file
display and change time
display and change date
clear the screen
set or display environment variables
Operating Systems: User Interfaces
14
External DOS commands







FDISK
FORMAT
CHKDSK
XCOPY
MEM
MORE
HELP
20 March 2003
partition a disk
add a file system to a disk
examine and repair a disk
powerful version of COPY
display DOS memory usage
display file one screen at a time
display command documentation
Operating Systems: User Interfaces
15
DOS Options
 dir

displays contents of current folder
filename, ext, size, date, time, windows filename
 dir/p
 dir/w
 dir/s
20 March 2003
pauses after each screen
uses wide list format (brief)
displays all subdirectories
Operating Systems: User Interfaces
16
More DOS Options
 dir/od displays files in order of date
 dir/o-d same but most recent date first
 dir/a
displays file attributes

directories, hidden, system, read-only, archive
 dir/ah
 dir/?
20 March 2003
displays hidden files only
displays help with the dir command
Operating Systems: User Interfaces
17
DOS Path
 Fully specifies the location of a file




disk, folder(s), filename, extension
e.g. c:\windows\command\fdisk.exe
shared computer, shared folder, filename, ext.
e.g. \\xpacer\SharedDocs\OS\index.htm
 OS uses search path to look for commands


type PATH at DOS prompt
put SET PATH command in autoexec.bat file
20 March 2003
Operating Systems: User Interfaces
18
DOS Batch Files
 text file, .bat extension, contains commands
 useful for multiple file move/copy/delete
 can also run other programs and batch files
 useful for repeating tasks on many computers
 can keep networked client PCs identical
20 March 2003
Operating Systems: User Interfaces
19
Using DOS Batch Files
 To create, edit or view a batch file

use text editor (DOS Edit, Notepad or WordPad)
 To run a batch file


double-click in Explorer, or
type its name at the DOS prompt or Run dialog
 To get information on any DOS command

type the command followed by /?
20 March 2003
Operating Systems: User Interfaces
20
Useful DOS batch file commands
 xcopy
 deltree
 call
 goto
 for
 if
 net
 echo

rem2003
20 March
powerful version of copy
delete directory and all subdirectories
calls another batch program
go to labelled line in a batch file
runs command on each file in a set
conditional
Windows networking functions
displays messages or command echoing
remark
(documentation
Operating
Systems: User Interfaces line)
21
Job Control Languages
 Used on large computers for batch jobs:




No human interaction/delays/interruptions
Routine jobs e.g. payroll, financial reports
Used resources are predictable, scheduled
Must manage errors without intervention
 Jobs are given rank/priority
 Jobs are allocated memory, processor time
20 March 2003
Operating Systems: User Interfaces
22
Graphical User Interfaces
 Usually an addition to command interfaces

e.g. Windows (DOS), X Windows (UNIX)
 Features include:




overlapping windows
screen cursor moved by pointing device
desktop, icons, taskbar, menus, dialog boxes
buttons, scroll bars, lists
20 March 2003
Operating Systems: User Interfaces
23