Connecting with Computer Science, 2e
Download
Report
Transcript Connecting with Computer Science, 2e
Connecting with Computer
Science, 2e
Chapter 9
Operating Systems
Objectives
• In this chapter you will:
– Learn what an operating system is
– Become familiar with different types of operating
systems
– Identify the major functions of an operating system
– Understand how operating systems manage
processes
Connecting with Computer Science, 2e
2
Objectives (cont’d.)
• In this chapter you will (cont’d.):
– Understand how operating systems manage
resources
– Understand how operating systems provide security
– Learn how to perform basic operating system file
management functions in Windows and Linux
Connecting with Computer Science, 2e
3
Why You Need to Know About...
Operating Systems
• Operating system (OS)
– Essential to the functioning of computers
– Controls operations inside the computer
• Operating system knowledge
– Improves efficiency
Connecting with Computer Science, 2e
4
What Is an Operating System?
• Program responsible for managing the user
interface, system resources, and processes
• Software control center
–
–
–
–
–
Loaded when computer boots
Resident in main memory
Loads and supervises all other programs
Provides interface to CPU and I/O devices
Capable of connecting with standard devices
• Written in programming languages: C and C++
Connecting with Computer Science, 2e
5
What Is an Operating System? (cont’d.)
Figure 9-1, An OS provides an interface between the user,
applications, and hardware
Connecting with Computer Science, 2e
6
What Is an Operating System? (cont’d.)
• Parts:
– Kernel: core program loaded at boot time by BIOS
• Small program
• Remains in memory the entire time the computer is on
– Modules: provide user and device interface
•
•
•
•
Main module responsible for user interface
Windows: provides graphical desktop
Linux: Gnome, KDE, or Xfce graphical interface
Drivers interface with I/O devices
• Loaded onto computer’s hard disk or ROM chip
Connecting with Computer Science, 2e
7
What Is an Operating System? (cont’d.)
Figure 9-2, Users and computer components interact with
the OS kernel
Connecting with Computer Science, 2e
8
What Is an Operating System? (cont’d.)
• Microsoft Windows
– Most widely used OS
• Disk Operating System (DOS)
– Predecessor to Windows
• Linux or UNIX is used on many servers
• Macintosh is used in schools
• OS running on a computer is called a platform
– OS fitted to a particular CPU
– Cross-platform application runs on multiple platforms
Connecting with Computer Science, 2e
9
What Is an Operating System? (cont’d.)
Table 9-1, OS development summary
Connecting with Computer Science, 2e
10
What Is an Operating System? (cont’d.)
Table 9-1, OS development summary (cont’d.)
Connecting with Computer Science, 2e
11
What Is an Operating System? (cont’d.)
Table 9-1, OS development summary (cont’d.)
Connecting with Computer Science, 2e
12
Types of Operating Systems
• Classified by features or intended uses
– Single-tasking: DOS and Windows 3.x
• Allows running only one process (task) at a time
– Multitasking: Windows, Linux, and Mac OS
• Supports more than one process running at a time
– Network operating systems (NOS): NetWare, UNIX,
Linux, and Windows Server 2008
• Designed to provide strong network services
– Multiprocessing
• Coordinated execution of a process, using two or more
CPUs at the same time
Connecting with Computer Science, 2e
13
Types of Operating Systems (cont’d.)
• Each OS is designed to be strong in a particular
area
– Microsoft Windows and Mac OS
• Appeal to home and small-business users
• Installed on the overwhelming majority of desktops
– UNIX and Linux
• Strong in multitasking, security, and multiprocessing
• Known for stability
• Server environment operating systems
– Many other OSs run on PDAs and cell phones
Connecting with Computer Science, 2e
14
Functions of an Operating System
• Basic functions
–
–
–
–
–
–
–
Provide a user interface
Schedule and manage program execution
Manage memory
Configure devices
Provide file management and security
Provide basic networking capability
Monitor performance
Connecting with Computer Science, 2e
15
Functions of an Operating System
(cont’d.)
• Four main categories
–
–
–
–
Providing a user interface
Managing processes
Managing resources (including memory)
Providing security
Connecting with Computer Science, 2e
16
Providing a User Interface
• User interface
– Program enabling computer communication
– DOS and Linux use a command-line interface
• Sometimes called console operating systems
• Command-line interface
– Type commands and receive responses in text format
• Command prompt
– Words and symbols displayed onscreen that indicate
the OS is waiting for user input
Connecting with Computer Science, 2e
17
Providing a User Interface (cont’d.)
• Graphical user interface (GUI)
– Information displayed in a graphical format
• User can select items using a pointing device (e.g.,
mouse)
– Clicking icons and buttons opens graphical windows
and allows menu selections
Connecting with Computer Science, 2e
18
Providing a User Interface (cont’d.)
Figure 9-3, The Windows command prompt emulates a DOS
environment (top); the default GUI interface of Windows Vista
(middle); and the GUI interface of Linux (bottom)
Connecting with Computer Science, 2e
19
Providing a User Interface (cont’d.)
Figure 9-3, (cont’d.)
Connecting with Computer Science, 2e
20
Providing a User Interface (cont’d.)
• Windows command prompt access
– Access at: All Programs, Accessories menu
– Emulates a DOS environment
– Provides backward compatibility
• GUIs can be added to Linux
– Standard Linux uses command-line interface
Connecting with Computer Science, 2e
21
Managing Processes
• Operating system responsibilities
– Loads, starts, supervises, and stops processes
• Process
– Each program running on a computer
– May start (spawn) other processes to support them
• Windows Task Manager shows running processes
– Accessed by pressing Ctrl+Alt+Delete keys
• Linux displays information on active processes
– Use the ps command
• DOS currently has no command to list processes
Connecting with Computer Science, 2e
22
Managing Processes (cont’d.)
Figure 9-4, Windows Task Manager
Connecting with Computer Science, 2e
23
Managing Processes (cont’d.)
Figure 9-5, Viewing processes in Linux with the ps command
Connecting with Computer Science, 2e
24
Managing Processes (cont’d.)
• CPUs only run one process at a time
– Von Neumann architecture supports serial execution
• Only one instruction from one single program per clock
cycle allowed
• Differences in component speed
– Allows CPU to execute extra instructions
• CPU executes billions of instructions per second
• Memory, keyboard, monitor, and network adapter
function at different speeds
– CPU multitasks while waiting
Connecting with Computer Science, 2e
25
Managing Processes (cont’d.)
• Time slicing
–
–
–
–
–
–
Allows multiple processes to share the CPU
Provides illusion of simultaneous execution
Attributable to the different speeds of devices
Managed by the OS
Complicated task
Uses interrupt handling
• Allows processes to interrupt the CPU
• Interrupts initiated by programs or devices
• Main interrupt handler: part of the OS
Connecting with Computer Science, 2e
26
Managing Resources
• Devices connected to the CPU
– Main memory, hard disk, and CD/DVD-ROM drive
– All running processes share these devices
• Configure I/O devices within environment
– Plug and Play (PnP) automates process (from 1995)
• Relieves manual jumper and switch setting
• Deadlock
– Resources freeze system
• OS must remedy or system will need rebooting
Connecting with Computer Science, 2e
27
Managing Memory
• OS manages memory
– Determines location of free space in memory
• Loads programs from disk to this memory location
– Constantly manages memory
– Communicates with CPU about where to begin
executing a program
Connecting with Computer Science, 2e
28
Providing Security
• OS protects memory and other resources
– Ensures resources distributed evenly among
competing processes
– Provides a means for allowing only authorized users
to access programs or devices
• Methods
– Set up password-protected user accounts
– Set up group policies
• Govern resources a class or group of users allowed to
access
Connecting with Computer Science, 2e
29
Using an Operating System
• It is helpful to understand:
– How an OS works
– How to perform basic tasks
• Skills focus:
– Basic file management tasks
Connecting with Computer Science, 2e
30
Managing Disk Files
• OS file organization
– Folder or directory
• Treelike structure
• Single root level and one or more branches
• Files viewed as leaves (nodes) on the tree structure
• Command-line operating systems:
– Linux and DOS
• Similar structure used
• Cannot view it as a tree structure
– Windows Explorer
• Manages files through graphical interface
Connecting with Computer Science, 2e
31
Managing Disk Files (cont’d.)
Figure 9-6, The Windows interface for working with
files and folders
Connecting with Computer Science, 2e
32
Managing Disk Files (cont’d.)
Figure 9-7, Linux command-line interface for displaying files and folders
Connecting with Computer Science, 2e
33
Partitioning Disks
• Before a disk can be used, it must be divided into
partitions and formatted
– Partitioning: dividing surface into specific areas
(partitions)
– Windows and Linux use the fdisk command
• Linux: case sensitive
• Windows: not case sensitive
Connecting with Computer Science, 2e
34
Formatting Disks
• After a disk has been partitioned, it can be formatted
– Arranges disk surface into addressable areas
– Sets up basic directory tree structure
– Places copy of the OS on the disk
• Used as a boot disk for starting the computer
Connecting with Computer Science, 2e
35
Formatting Disks (cont’d.)
Table 9-2, Formatting disks
Connecting with Computer Science, 2e
36
Creating Folders (Subdirectories)
• Store files on disk
– Done after disk partitioned and formatted
– Divides disk further into folders or directories
• Can also contain subfolders or subdirectories
• Root: main level
– Create one or more folders at root
– Folder may lie within root folder
• Always a current subdirectory (folder) in use
– View prompt in command-line interfaces
– View status bar in Windows
Connecting with Computer Science, 2e
37
Creating Folders (Subdirectories)
(cont’d.)
• Parent-child structure has nearly unlimited depth
– Avoid creating more than 10 levels in the structure
• Each OS enables user to create directories (folders)
– Folders named according to specific rules
– General rules
•
•
•
•
Folder names must start with a letter
Maximum length of 255 characters
UNIX: case sensitive
DOS and Windows: not case sensitive
Connecting with Computer Science, 2e
38
Creating Folders (Subdirectories)
(cont’d.)
Table 9-3, Creating folders
Connecting with Computer Science, 2e
39
Listing the Contents of Drives and
Folders
Table 9-4, Listing the contents of drives and folders
Connecting with Computer Science, 2e
40
Listing the Contents of Drives and
Folders (cont’d.)
Table 9-4, Listing the contents of drives and folders (cont’d.)
Connecting with Computer Science, 2e
41
Renaming Folders and Files
Table 9-5, Renaming folders and files
Connecting with Computer Science, 2e
42
Deleting Folders and Files
• Deleting folders requires care
– Can delete all folders and files inside, too
– Windows: provides recovery (Recycle Bin)
– Linux: no recovery mechanism
• Wildcard: symbol used to select files or directories
– Asterisk (*) and question mark (?)
– Examples:
• c:\windows\system32\drivers\*.inf
• *.exe (signifies all .exe files)
• a*.bat (signifies all .bat files starting with “a”)
Connecting with Computer Science, 2e
43
Deleting Folders and Files (cont’d.)
Table 9-6, Deleting folders and files
Connecting with Computer Science, 2e
44
Copying Files and Folders
• Copy into folders or store at root
– Possible after basic folder and file structures set up
• Partitioning, formatting, and creating folders
– Prepares drive to receive files
• One of the most important skills to learn
– Organize drives into folders
• Improves work effectiveness
• Helps in performing proper backups
Connecting with Computer Science, 2e
45
Copying Files and Folders (cont’d.)
Table 9-7, Copying files and folders
Connecting with Computer Science, 2e
46
Moving Files and Folders
• Similar to copying files
– Copy command followed by delete command
Table 9-8, Moving files and folders
Connecting with Computer Science, 2e
47
One Last Thought
• Operating systems are a central part of computing
– Learning the basic OS concepts and how to use them
are essential
– Concepts are taught alongside practical skills
• Advanced study is recommended
Connecting with Computer Science, 2e
48
Summary
• Operating systems:
–
–
–
–
–
–
Software control center of the computer
Consist of a kernel and other system programs
Loaded into RAM by program in BIOS chip
May be single tasking or multitasking
Time slicing is a method for multitasking
Basic tasks: provide user interface, manage
processes, manage resources, provide security
– Two interfaces: GUI and console window
– Supervise program in execution (process)
Connecting with Computer Science, 2e
49
Summary (cont’d.)
• Operating systems (cont’d.)
– Interface hardware elements through drivers
– Protect system from intended or unintended violations
• OS file management:
–
–
–
–
Partitioning/Formatting disks
Creating folders (subdirectories)
Listing/Renaming folders and files
Deleting/Copying/Moving folders and files
Connecting with Computer Science, 2e
50