Você está na página 1de 13

Resource Management

6.1.1. Identify the resources that need to be managed within a computer system

Resources include:

primary memory
secondary storage
processor speed
bandwidth, screen
resolution
disk storage
sound processor
graphics processor
cache
network connectivity

What is a resource?
Here a resource is something that
the CPU (or the CPU itself) of a computer has directly or indirectly connected to it that it can use/utilize.
A resource, or system resource, is any physical or virtual component of limited availability within a computer system.
Every device connected to a computer system is a resource. Every internal system component is a resource. Virtual
system resources include files, network connectionsand memory areas.

Which resources does a computer need to operate?


A computer is an electronic device that runs a stored program using a processor (CPU). For a CPU to operate it needs a
program that is stored first in a permanent storage device
The minimum of resources a computer needs to function are:
CPU
to process the stored instructions
the CPU has internal resources
o Registers to hold intermediate results of processing actions
o Control Unit to sequence and coordinate actions in the CPU
o ALU to do the actual arithmetic and logic involved in each program instruction

ROM

RAM

to store a program which will be executed when the machine is first switched on
to allow the CPU to have an available memory storage area that it can use for the program that it is running

The more things you need your computer to do the more resources it needs to have:
Primary Memory
allows the CPU a place to hold data while it is processing and remember programs that are currently open
Secondary Storage
to hold programs including the operating system
to store files
Processor Speed
the speed at which the processer operates must be managed by the operating system and depends on the
running of multiple programs via multi-tasking
Bandwidth, Screen Resolution
the passing of data to the monitor/screen must be managed
Disk Storage
reading and writing to the disk must be managed along with keeping track of where all the files are on the disk
(registries)
Sound Processor
if you want your system to be able to deliver sound to the user then you must manage the processing of digital
audio data and passing it to the analog speakers
Graphics Processor
to allow the computer to create a visual display the computer must create digital signals that control the pixels
on a screen. this involves managing the different stages involved
Cache
a computer can run faster if it has an intermediate type of memory in-between the ram and the processor that
predicts which data might be needed by the CPU next and operates at a higher speed than RAM
Network Connectivity
if a computer is to be connected to other computers over a network the processing of messages/data between
the computers must be managed

You get the idea..


All the parts are resources (including the different bits of software involved that manage each area) and the more that
you want the computer to be able to do, the more parts (resources) you need to get the job done. We can take this idea
and apply it to all the different types of computer we can think. They all have a range of resources and each resource is
controlled directly or indirectly by the CPU (the Central Processing Unit).

Smart Phones
PDAs
Netbooks
Notebooks
Servers
Main Frame Computers, etc.

6.1.2 Evaluate the resources available in a variety of computer systems.


There are many types of computer systems available now and almost all of them have different resources available that
need to be managed. Some of the computer systems include:

Mainframe Computers: Powerful, multi-user, centralisedcpu/memory/disk

Servers: Provides services across network File Server, Database Server, Print Server

Desktop PCs: General use personal computer. Performs regular, daily tasks.

Laptops: General use but portable PC.

Smart phones: Digital device able to perform many of the functions of a computer. Typically having a relatively
large screen.

Resources that could be managed:

Mainframe: - Processor time

Server: - Primary memory, Secondary storage, Bandwidth

Desktop PC: - Primary memory, Secondary storage

Laptop: - Battery charge, Primary memory, Secondary storage

Smart phone: - Battery charge, Primary memory

6.1.5: Operating Systems functions

An operating system is a piece of software that


communicates and controls the hardware of a
computer directly

Operating System (OS) - Definition:

first program loaded

core software component coordinating the hardware

controls/organizes general operations

Communicating with Peripherals:

manages peripherals (ex. printer, graphics card, keyboard, etc.) using drivers
o

Driver: software, ensuring interaction between computer and device

provides standard interface between hardware devices and applications

Enables generic commands such as the "print"-statement within the high-level programming languages to work
on any PC, even if the hardware differs greatly.

Hardware is only able to deal with binary machine code or if a conversion between digital and analog formats
has taken place (digital to analog conversion).

Plug and Play: feature that allows devices to be used without installing extra divers

Interfaces:

Graphical User Interface (GUI)


o

Windows XP

Macintosh

Command Line Interface (CLI)


o

MS DOS

Unix (Linux) Shell

Coordinating Concurrent Processing:

processes constantly running if computer turned on

OS manages the loading and unloading of processes to & from primary memory

Resource Management:

memory and capacity of CPU shared/managed between programs to allow maximum functionality

organises use of memory and processing time

manages processes in the background, while user is working with programs in the foreground
o

keeping track of which files, ports, data resources belong to which program

Memory Management:

organises memory through file management system (see additional information below for more)
o

allocates files

allows user to change file names & paths

backing storage controlled

handels transfer of data or instructions between primary and secondary memory

every process has specific space in primary memory


o

ensures other process spaces is not overridden - each process operates in own virtual memory space

would cause "memory access violation"

If the program & data management breaks down, programs might write to another programs's files or the
system might crash.

manages use of virtual memory & swap files

Scheduling:
o

long term (admission)

decides which jobs are sent to queue

mid term (swapping out)

removes data from RAM to HDD/SSD

short term (dispatcher)

decides what is executed next

Accounting and Security:

maintains security

management of user accounts and user activity


o

manages access rights

provides services (e.g. firewalls)

user authentication
o

passwords

voice recognition

biometrics

logs everything done on computer

important in multi-user environments


o

Audit-trail: logging of user activity to track hacking attempts, hogging of resources, etc.

System Tools:

Errors:

includes monitoring of performance, debugging and maintenance

outputs simple messages for users if error occur

Additional Information:

File Systems - 2 Types:


o

File Allocation Table (FAT)

table tracking where the data is stored

New Technology File System (NTFS)

introduced by Microsoft

advantages:

higher reliability - errors repaired without message

transaction logs - errors tracked

Types of Operating Systems:


1. Real Time Operating System (RTOS)

same amount of time needed for processing each time - e.g. mechanics

2. Single User - Single Task

e.g. phone

3. Single User - Multi-Task

e.g. PC

4. Multi-User

e.g. Mainframe

Modes of Operation:
o

real time processing

multi-programming

seems like multiple programs are running at once - programs run according to priority

interactive processing

quick processing of input to generate output

continues exchange of information between user & computer

multi-tasking

tasks run concurrently - resources split

multi-acces or multi-user

same system used via LAN

CPU manages one user after another - the more users, the slower

6.1.7 Outline OS resource management techniques: scheduling, policies, multitasking, virtual memory, paging,
interrupt, and polling.
Interrupt
When an interrupt is received, the computer's hardware automatically suspends whatever program is currently running,
saves its status, and runs computer code previously associated with the interrupt; this is analogous to placing a
bookmark in a book in response to a phone call. In modern operating systems, interrupts are handled by the operating
system's kernel.Interrupts may come from either the computer's hardware or from the running program.
When a hardware device triggers an interrupt, the operating system's kernel decides how to deal with this event,
generally by running some processing code. The amount of code being run depends on the priority of the interrupt (for
example: a person usually responds to a smoke detector alarm before answering the phone). The processing of
hardware interrupts is a task that is usually delegated to software called device driver, which may be either part of the
operating system's kernel, part of another program, or both. Device drivers may then relay information to a running
program by various means.
A program may also trigger an interrupt to the operating system. If a program wishes to access hardware for example, it
may interrupt the operating system's kernel, which causes control to be passed back to the kernel. The kernel will then
process the request. If a program wishes additional resources (or wishes to shed resources) such as memory, it will
trigger an interrupt to get the kernel's attention.
There are two types of interrupts:
Hardware interrupts are used by devices to communicate that they require attention from the operating system. For
example, pressing a key on the keyboard or moving the mouse triggers hardware interrupts that cause the processor to
read the keystroke or mouse position. Hardware interrupts are asynchronous and can occur in the middle of instruction
execution, requiring additional care in programming. The act of initiating a hardware interrupt is referred to as
an interrupt request (IRQ).
A software interrupt is caused either by an exceptional condition in the processor itself, or a special instruction in
the instruction set which causes an interrupt when it is executed.
For example, if the processor's arithmetic logic unit is commanded to divide a number by zero, this impossible
demand will cause a divide-by-zero exception, perhaps causing the computer to abandon the calculation or display an
error message. Software interrupt instructions function similarly to subroutine calls and are used for a variety of
purposes, such as to request services from low-level system software such as device drivers.

Multitasking
Multitasking is a method where multiple tasks (also known as processes) are performed during the same period of
time they are executed concurrently (in overlapping time periods, new tasks starting before others have ended)
instead of sequentially (one completing before the next starts). The tasks share common processing resources, such as
a CPU and main memory.
Operating systems may adopt one of many different scheduling strategies, which generally fall into the following
categories:

In multiprogramming systems, the running task keeps running until it performs an operation that requires
waiting for an external event (e.g. reading from a tape) or until the computer's scheduler forcibly swaps the
running task out of the CPU. Multiprogramming systems are designed to maximize CPU usage.

In time-sharing systems, the running task is required to relinquish the CPU, either voluntarily or by an external
event such as a hardware interrupt. Time sharing systems are designed to allow several programs to execute
apparently simultaneously.

In real-time systems, some waiting tasks are guaranteed to be given the CPU when an external event occurs.
Real time systems are designed to control mechanical devices such as industrial robots, which require timely
processing.

Polling
To make a system work, the OS will need to check regularly if its devices have become ready. This is called polling.
The OS runs at regular intervals (say, once per millisecond) to check each device to see if it is ready. If ready, then the
OS further deals with the device.

For a ready keyboard, the character typed is placed into a queue.

For a ready display, the queue is checked. If not empty, then the next character in the queue is sent to the
device.

Memory management: The process of keeping track of what programs are in memory and where in memory they
reside
Process: A program in execution
Process management: The act of carefully tracking the progress of a process and all of its intermediate states

Scheduling
One of the primary functions of an operating system is to distribute the resources under its control among the users of
the system in such a way as to achieve installation standards of performance (including service).
Scheduling determines which process in memory is executedby the CPU at any given point. It is method by which
threads, processes or data flows are given access to system resources (e.g. processor time, communications
bandwidth). This is usually done to load balance and share system resources effectively
Scheduling Policies/ Algorithm

Virtual Memory

An imaginary memory area supported by some operating systems (for example, Windows but not DOS) in conjunction
with the hardware. You can think of virtual memory as an alternate set of memory addresses.
The purpose of virtual memory is to enlarge the address space, the set of addresses a program can utilize. For
example, virtual memory might contain twice as many addresses as main memory. A program using all of virtual

memory, therefore, would not be able to fit in main memory all at once. Nevertheless, the computer could execute such
a program by copyinginto main memory those portions of the program needed at any given point during execution.
To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of
which contains a fixed number of addresses. Each page is stored on a diskuntil it is needed. When the page is needed,
the operating system copies it from disk to main memory, translating the virtual addresses into real addresses.
Paging
In computer operating systems, paging is one of the memory-management schemes by which a computer can store and
retrieve data from secondary storage for use in main memory. In the paging memory-management scheme, the
operating system retrieves data from secondary storage in same-size blocks called pages. The main advantage of
paging over memory segmentation is that it allows the physical address space of a process to be noncontiguous. Before
paging came into use, systems had to fit whole programs into storage contiguously, which caused
various storage and fragmentation problems.
Paging is an important part of virtual memory implementation in most contemporary general-purpose operating systems,
allowing them to use secondary storage for data that do not fit into physical random-access memory (RAM).
The main functions of paging are performed when a program tries to access pages that are not currently mapped to
physical memory (RAM). This situation is known as a page fault. The operating system must then take control and
handle the page fault, in a manner invisible to the program. Therefore, the operating system must:

Determine the location of the data in secondary storage.


Obtain an empty page frame in RAM to use as a container for the data.
Load the requested data into the available page frame.
Update the page table to refer to the new page frame.
Return control to the program, transparently retrying the instruction that caused the page fault.

Thrashing
When paging are used, a problem called "thrashing" can occur, in which the computer spends an unsuitably large
amount of time transferring pages to and from a backing store, hence slowing down useful work. The phenomena is
associated with the concept of a working set which is the minimum set of pages that should be in memory in order for
useful progress to be made in a task. Thrashing occurs when there is insufficient memory available to store the working
sets of all active programs. Adding real memory is the simplest response, but improving application design, scheduling,
and memory usage can help. Another solution is to reduce the number of active tasks on the system. This reduces
demand on real memory by swapping out the entire working set of one or more processes.
Spooling
In computing, SPOOL is an acronym for simultaneous peripheral operations on-line. It is a type of buffering. The most
common spooling application is print spooling, which places a task (or 'print job') into a queue for extended or later
processing.
The most common spooling application is print spooling: documents formatted for printing are usually stored into an
area on a disk and retrieved and printed by a printer at its own rate. Printers typically can print only a single document at
a time and require seconds to minutes to do so. With spooling, multiple processes can write documents to a print queue
without waiting. As soon as a process has written its document to the spool device, the process can perform other tasks,
while a separate printing process operates the printer.
For example, when a city prepares payroll checks, the actual computation may take a matter of minutes or even
seconds, but the printing process might take hours. If the program printed directly, computing resources (CPU, memory,
peripherals) would be tied up until the program was able to finish. The same is true of personal computers. Without
spooling, a word processor would be unable to continue until printing finished. Without spooling, most programs would
be relegated to patterns of fast processing and long waits, an inefficient paradigm.

6.1.9 Outline how an operating system hides the complexity of the hardware from users and applications.
Abstraction:
OS abstraction layers deal with presenting an abstraction (hides) of the details of the different hardware configurations,
thereby ensuring that application do not need to be tailored for each possible device that might be present on the
system

What resources are managed in a computer system?


Primary memory (RAM)
Secondary storage (hard drive/disk storage)
Central Processing Unit (CPU)
Graphical Processing Unit (GPU)
Network bandwidth/connectivity
Screen resolution
Sound processor

How do resources differ on different systems?


Cost vs. Performance
No need to spend money on extra hardware if it is not needed
Examples:
Screens for mainframes and servers
Hard drives for cell phones
GPU for an e-book
What problems could occur from limited resources?
Limited memory use of secondary storage as memory
Secondary storage is slower time lost
Limited CPU programs run slower or system stalls
Limited GPU choppy, undetailed graphics
Limited network connectivity constant buffering and delays

Operating System Roles


Hardware management
Communicating with all hardware
Resource monitoring
processor time, memory usage, etc.
Coordinating concurrent processing
multiple programs (processes) running at the same time
Memory management
each program has their own space in memory
**Operating system hides the complex activities above from the user!**

Multi-processing/Multi-tasking
Memory allocation
Load program from hard drive into a section of memory (RAM)
Time-slicing (sharing CPU time across programs)
Giving a particular program a slice of time to run
Priority
A program can be given priority if its more important
e.g. window in focus, streaming services

Virtual Memory
What happens when you run too many programs and all of the memory is used up? What other storage is
there?
How do we keep some memory free at all times?

Virtual Memory Terms


Paging / Swapping
Moving program data between memory and disk
Where do you see this stuff?
pagefile.sys in windows
/swap space in linux
Whenever you use up all your RAM and your hard drive goes crazy.
Optimizations
Whole programs do not have to fit in memory contiguously (all in one section)
Prevents memory segmentation
Pre-emptive paging

Discussion: Why are there different operating systems?


Mac OS X vs. iOS
Ubuntu Linux vs. Android
Advantages? (Hint: think in terms of design)

How does the OS represent hardware devices?


Hardware complexities are hidden from the user by the OS
Hardware is simplified and represented virtually by the OS
Examples
Mouse pointer
File tree and drive letters
Others?
OS Hardware Communication
How does the OS know when to communicate with hardware?
Interrupt vs. Polling
What do you think they mean?

Você também pode gostar