Part II: Software In part II, we focus on topics associated with software. In particular, we will...

Post on 11-Jan-2016

217 views 5 download

Transcript of Part II: Software In part II, we focus on topics associated with software. In particular, we will...

Part II: Software

• In part II, we focus on topics associated with software. In particular, we will investigate the discovery, representation, and communication of algorithms.

• Operating systems and networks.• Algorithms.• Programming languages.• Software engineering.

Ch. 3 Operating Systems and Networks

• The evolution of operating systems.• Operating system architecture.

• Coordinating the machine’s activities.

• Handling Competition among processes.

• Networks.

• Network protocols.

Operating Systems

• Why needs an operating system? • Computer applications often require a single machine

to perform activities that may compete with one another for the machine’s resources. It requires a high degree of coordination to ensure that unrelated activities do not interfere with one another and that communication between related activities is efficient and reliable.

• What is an operating system? A software system which handles such a coordination task.

The evolution of Operating Systems

• Single-processor systems.• Batch processing - the execution of jobs

(programs) by collecting them in a single batch, then executing them without further interaction with the user.

• A job queue (FIFO) and a job control language (JCL).

• The main drawback to batch processing is no interaction between user and job.

The Evolution of Operating Systems

• Interactive processing.• Real-time processing.• Time-sharing.• Multitasking - time-sharing for a single-us

er system.• From multiprocessor systems to networks.

Operating System Architecture

Software

Application System

Utility Operating system

Shell Kernel

Operating System Architecture

• A machine’s software can be divided into two categories: application software and system software.

• Application software - the programs for performing tasks particular to the machine’s utilization.

• System software - performs tasks which are common to computer systems in general.

Operating System Architecture

• System software can be divided into two categories: operating-system software and utility software.

• Utility software consists of software units that extend the capabilities of the operating system. For example, the ability to format a disk or software for communicating through a modem over telephone lines.

Operating System Architecture

• Shell - the portion of an operating system that defines the interface between the operating system and its users.

• Graphical user interface (GUI).• Importance of uniformity in the human-

machine interface across a variety of machines.

• UNIX Vs. MS-DOS and Windows.

Operating System Architecture

• Kernel - the internal part of an operating system, which contains those software components that perform the very basic functions required by the computer installation.

• File manager - file descriptor and directory (folder).

• Device drivers - communicate with controllers.

Operating System Architecture

• Memory manager - virtual memory.• Scheduler and dispatcher.• Booting (boot strapping).• Bootstrap - a short program placed in ROM and t

his program is executed automatically when the machine is turned on.– transfer the operating system to memory

– direct the CPU to execute the operating system

Coordinating the Machine Activities

• Process - is a dynamic activity whose properties change as time progresses.

• Process state - current status of the activity, including the current position in the program being executed and the values in the other CPU registers and the associated memory cells.

• A program Vs. a process.• Interprocess communication.

Coordinating the Machine’s Activities

• Process administration - the tasks associated with process coordination are handled by the scheduler and dispatcher within the operating system’s kernel.

• Process table - keeps information of a process; when a process is created, it is assigned a memory area, a priority, and a status - ready or waiting.

Coordinating the Machine’s Activities

• The dispatcher is the component of the kernel that ensures that the scheduled processes are actually executed.

• In a time-sharing system, the time is divided into time slices or quanta.

• The dispatcher initiates a timer circuit each time a process begins its time slice.

• At the end of the time slice, the timer circuit generates an interrupt.

Coordinating the Machine’s Activities

• When the CPU receives an interrupt, it saves the current state of the process in the process table, and begins executing the interrupt handler, which is a part of the dispatcher.

• At this moment, the dispatcher allows the scheduler to update the process table.

Coordinating the Machine’s Activities

• The dispatcher then selects the highest priority process among the ready processes, restarts the timer circuit, and allows the selected process to begin its time slice.

• At times a process’s time slice is terminated before the timer has expired (for example, an I/O request), the scheduler will update the process table to reflect the process’s waiting status.

Coordinating the Machine’s Activities

• Later, when the controller indicates that the I/O request has been completed, the scheduler will reclassify the process as ready.

Coordinating the Machine’s Activities

• The various units within an operating system compete for time slices under control of the dispatcher.

• To coordinate their activities, these processes must communicate with one another.– For example, to schedule a new process, the sc

heduler must obtain memory space from the memory manager for that process

Coordinating the Machine’s Activities

• The client/server model for inter-process communication.

• A client makes requests to servers and waits for replies.

• A server satisfies the requests and sends replies back to the clients.

• The client/server model in the design of software leads to uniformity among the types of communication taking place in the system.

Handling Competition Among Processes

• Competing resources among processes.• The file manager allocates both access to current

files and disk space for the construction of new files.

• The memory manager allocates memory space.• The scheduler allocates space in the process

table.• The dispatcher allocates time slices.

Handling Competition Among Processes

• To control access to the printer, the operating system must keep track of whether the printer has been allocated.– By a flag: check the flag then set the flag

– Problem: check the flag and find it clear; the process is then interrupted; the new process also requests the use of the printer; the operating system allows it to use the printer; later, the first process resumes and the operating system allows it to use the printer too

Handling Competition Among Processes

• Interrupt disable and interrupt enable.• Test-and-set instruction.• A properly implemented flag is called a se

maphore.• Critical region - a sequence of instructions

which can be executed by only one process.– Mutual exclusion– Guard the critical region with a semaphore

Handling Competition Among Processes

• Deadlock - when two or more processes are blocked from processing because each is waiting for access to resources allocated to another.

• Three necessary conditions for deadlock:– 1. There is competition for non-shareable

resources

Handling Competition Among Processes

– 2. The resources are requested on a partial basis; that is, having received some resources, a process will return later to request more

– 3. Once a resource has been allocated, it cannot be forcibly retrieved

• Deadlock detection and correction to attack the third condition.

• Deadlock avoidance to attack the first two conditions.

Handling Competition Among Processes

– Require each process to request all its resources at one time

– Make nonshareable resources appear shareable• holding data for output at a later but more convenie

nt time• spooling

Networks

• Local area networks (LAN) Vs wide area networks (WAN).

• Open networks Vs proprietary networks.

• Network configurations - ring, bus, star, and irregular.

Networks

• Internet - initiated in 1973 by the Defense Advanced Research Projects Agency (DARPA) to develop the ability to connect a variety of computer networks so that they can function as a single network.– A collection of network clusters (domains)

• Internet addressing - network identifier, host address; ex., 192.207.177.133.– ssenterprise.awl.com– alpchen.cs.nthu.edu.tw

Networks

• Email and name server.– wshakespeare@mailroom.awl.com– chunghaw@cs.nthu.edu.tw

• The world wide web - hypertext and hypermedia documents.

• A browser - a client.

Networks

• Uniform resource locator (URL) - a browser can contact the proper server and request the desired document.– Figure 3.12, homepage: http://www.awl.com, portal

• Hypertext Markup Language (HTML).– Special markers that describe how the document shoul

d appear on the computer screen and which items within the document are to be linked to other documents for a browser to perform its task

Network Protocols

• Protocols - the rules that govern the communication between different components within a computer system.

• Token ring protocol for networks with the ring topology (Figure 3.13).

• CSMA/CD (carrier sense, multiple access with collision detection) in an Ethernet (Figure 3.14).

Network Protocols

You

Shipper

Airline

Customer

Shipper

Airline

Package Package

Container Container

Aircraft

Application layer

Network Protocols: The Internet Software Layer

Transport layer

Network layer

Link layer

Application layer

Transport layer

Network layer

Link layer

Message source Message destination

Network Protocols: The Internet Software Layer

• Application layer consists of software units that must communicate with each other across the Internet.– FTP, telnet, requires name server services

• Transport layer divides long messages into packets.

• Network layer wraps the packets it receives with the intermediate address.

• Link layer deals with the communication details (whether token ring or bus is used).

• Figure 3.17.

Network Protocols

• Open system interconnection (OSI) reference model produced by International standards organization (ISO).– Seven-level hierarchy

• TCP/IP protocol suite defines the four-level hierarchy.

Networks

• Unauthorized access to information and vandalism.

• Passwords and data encryption.• Virus and worm.