340 likes | 437 Views
OS and Data Storage. CSCI130 Instructor: Dr. Imad Rahal. Layered Architecture. Introduction. Software is the set of all programs that run on a computer VS Hardware : “Hard” Has a physical presence Comes in two forms System Software : controls the computer
E N D
OSand Data Storage CSCI130 Instructor: Dr. Imad Rahal
Introduction • Software is the set of all programs that run on a computer • VS Hardware : “Hard” • Has a physical presence • Comes in two forms • System Software: controls the computer • Applications Software: accomplishes user-defined tasks
System Software • Hide complex details • Registers, empty memory locations, starting location of program in memory operations in ALU, etc … • Assembly translation programs (Assembler/Loader) • Computer users, and even programmers, do not have to be aware of such details • System software provides this great flexibility • Interface between user and hardware
System Software Applications Software USER Hardware System Software • Makes a virtual computer which hides almost all technical details from the user resulting in user-friendly experiences • No need to worry about details such as register size of memory location of a given program • The system takes care of it AUTOMATICALLY Every data or instruction works its way through: Even a simple mouse click !
System Software • System software comes in three forms • Translation programs • E.g. assembler • Assembly to machine language • More on this issue when we study other programming languages (next chapter) • Operating systems • Utility program • Communication programs
Operating Systems (OS) • A collection of programs that • Manages your computer • Defines HOW a computer willinteract with the outside • Prepares programs and their data to interact with hardware • Booted up, • The OS is loaded into main memory for initialization • BIOS • BIOSs held in ROM (cannot be altered) • Hides all details • Giving us the illusion of being the only user whose entire program is loaded into memory
OS - Security • Usernames and passwords are ubiquitous in OSs to control access to computers • Care must be taken in choosing usernames and passwords • Programs can be written to try all words in a dictionary in order to guess your password • Long • Meaningless to others • NEVER SHARE • SYSTEM LEVEL • You want to control the access to some resource or file even for authorized users (i.e. having access to the computer) (OSs provide permissions • Read, Write, Execute or NONE • Per file • OS maintains a list of authorized users per file along with their permissions
OS - I/O & Auxiliary Storage • Passing of information between main memory and peripheral devices • I/O & Auxiliary Storage • E.g. Printers, mice, keyboards, disks, tapes, etc … • For I/O: Translation of input data to binary and output data from binary (to whatever the I/O device is using) • For secondary storage: Supervision and organization of data stored on tapes and disks (Auxiliary storage)
OS - I/O & Auxiliary Storage • Writing to Disks • Find empty space • Transfer data (No translation) • Update disk directory (location of new file) • Update list of empty space • Attempts to optimize the use of available space • How to find the best fit for a particular file? • First available position that could accommodate the file • One with close size to that of the file • Split into more that one position
OS - I/O & Auxiliary Storage • Deleting from disk • Update directory only • Remove the files entry • Add space occupied by file to available space • A fragmented disk usually has empty space but this space is scattered all over the disk with not much contiguity • Defragmenters
CPU Allocation • Single-user systems allocate all CPU time to one user/program • Multi-user systems? • Sharing main memory and CPU time • CPU is very efficient • Process between millions to billions of instructions per second • Other devices on the computer aren’t as fast • Printers: 100 characters per second • Disks: • several milliseconds to look up address in directory • several milliseconds to locate track and sector (spin disk) and position the R/W head • Physical motion will always be slower than transferring electric pulses • I/O bound • A machine whose performance is limited due to I/O • CPU is idle most of the time
CPU Allocation • Solutions • Overlapped processing • Running other programs while current is waiting for I/O • Good for I/O • What about short programs waiting for long ones? • Starvation • Multi-tasking (multiprogramming, timesharing) • All programs requesting CPU time will have access to it in timeslices • All are in memory together and are listed in a a ready queue
Multi-tasking • 1 CPU, 1 main memory with many users • When the CPU has time, it picks the first in ready queue and runs it for a timeslice • Saves a snapshot of the state of the current program (CU registers) • Moves on to the next one and places the old back in the ready queue • All processes run together • User won’t notice because the timeslice is very short • We CAN’T perceive time spans of less than 40-50 milliseconds • Shorter timelices • + Give the illusion of continuous process • - Not very good if most of time is spent on saving the snapshots (wasted time) • We need to strike a balance
Parallel processing • As opposed to multi-tasking • 1 main memory, many CPUs with many users • Jobs can be distributed among CPUs • Even one job can span many CPUs each working on some subtask • Very complex process • Beyond the scope of this course
OS - Memory Management • RAM VS Hard disk • Assume multitasking • 1 CPU, many programs • Can’t all fit in memory • OS keeps list of empty space • Adds to it when programs are done • Fragmentation could happen
OS - Memory Management • Compaction
OS - Memory Management • Paging • Allow one program to occupy many noncontiguous memory segments (pages)
OS - Memory Management • Swapping • What if there are no pages to fit all program? • Start program by loading only needed pages • Swap between needed and unneeded ones
Networks • We are not in isolation anymore • Help computers communicate • Transfer datawithout physical intervention (i.e. not via disk or tape) • Sharing resources • 5 users and all want to access a printer? • LANs • Limited to a single building or campus • WANs • Span cities, countries and even continents
Network Topologies Ring vs. Star topologies
Types of Connections • Physical connections • Twisted-pair wire • Two insulated copper wires wrapped around each other. • Transmit electrical signals • US phone system • Used to form WANs
Networks • Coaxial cable • Insulated copper wire • Used for cable TVs • Faster and less prone to interference than twisted-pair but more expensive
Networks • Fiber Optics • Fastest • Transfer light instead of electricity • No weight • Less prone to interference • Expensive to install
Wireless Networks • Wireless (non-physical) connections • Radio waves (In LANs) • Where physical wiring isn’t very convenient • Prone to a lot of interference from radio transmitters • Microwaves (In WANs) • Use high frequency radio signals which travel easily but only in straight lines • Relay towers must be set up at intervals or satellites must be used for larger distances • Carries more data (high frequency)
Wireless Networks • Types of electromagnetic waves • They only differ from each other in wavelength/frequency • Wavelength is the distance between one wave crest to the next
Wireless Networks • The potential drawbacks to a wireless solution include • Intervening hills and tall buildings or trees can block the radio frequency (RF) signals • "line-of-sight“: antennas must be able to "see" each other • Severe weather, can adversely affect signal transmission • Might be susceptible to other radio frequency interference • Dense fog could possibly be a problem for microwave links
Networks • Bandwidth • Depends on the link between two computers • Measured in bps • Twisted-pair: 10-100 Mbps • Fiber optic: > 2400Mbps=2.4Gbps
Networks Over the Phone System • Phone systems transfer data as continual electrical signals that forms a wave • Varied frequency and amplitude • Analog signal • Computer phone • Digital to analog • Computer phone • Digital to analog • Modem • Capable of transmitting a certain number of bits per second • >14,400 up to 56K
Protocols • Is a rules that governs the transmission of data within a network • How machines are addressed • How messages are addressed • Who can view or transmit a sent message • How will the message be packed/unpacked by sender/receiver • How to deal with transmission errors • Sender, receiver and intermediaries must agree on a communication protocol before communicating
Protocols • Sender steps • Layer 1: (Application) A message is usually generated by some application on the sender • Layer 2: (Packaging) The message is packaged for transmission • Layer 3: (Network) routing the message to receipt • Layer 4: (Physical Link) does the actual sending
Protocols • Intermediary steps • Layer 3: (Network) consulted only here • Check message and forward • Layer 4: (Physical Link) consulted only here • Does actual forwarding • Receiver steps • Layer 4: (Physical Link) comes thru to next layer • Layer 3: (Network) Received here • Layer 2: (Packaging) checks for any transmission errors and unpacks • Layer 1: (Application) presents to user/program