New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here


by: Dorothea McGlynn


Dorothea McGlynn
GPA 3.98


Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Class Notes
25 ?




Popular in Course

Popular in ComputerScienence

This 13 page Class Notes was uploaded by Dorothea McGlynn on Monday October 19, 2015. The Class Notes belongs to CS 411 at Oregon State University taught by Staff in Fall. Since its upload, it has received 18 views. For similar materials see /class/224510/cs-411-oregon-state-university in ComputerScienence at Oregon State University.

Similar to CS 411 at OSU

Popular in ComputerScienence




Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 10/19/15
Lecture 2 CS 41 151 1 Irwin Yoon TA 100202 Topics Introduction To Operating Systems Operating Systems and Hardware Introduction to Operating Systems An Operating system is a program software Sometimes called kernel Operating systems manage interaction with devices memory disk printers keyboard etc Operating systems act as an intermediary between a user and the hardware Prevents users from directly accessing hardware Operating systems act as resource manager Operating systems are designed to make a user s life easier Examples Some Illustrations on how an os makes dealing with the hardware easier 7 Imagine the complexities of writing to disk without aid of operating systems User s simply do a write 7 What if a 3 simultaneous requests are sent to the printer 7 What if each user program had to handle address mapping and memory allocation directly with the memory unit Multiprogramming Uniprogramming 7 Execution of only 1 program at a time 7 Example 7 early batch system card reader Multiprogramming 7 Execution of multiple programs at one time 7 All programs share CPU time 7 U0 Example 7 Q What type of overhead is involved with switching programs back and forth Fig 15 Tannebaum CPU Who gets the CPU For how long Are registers stored by the operating system Memory Fig 17 How does caching work The longer the memory access the more wasted cycles What if 1 program is waiting a long time for write to disk Cache Miss penalty Kernel Mode How does an OS prevent malicious users from overwriting the kernel or another program s memory space How does an OS prevent other programs from running privileged instructions Kernel Mode when kernel is currently running allows privileged instructions User Mode when the user s program is currently running no privileged instructions What happens when someone in user mode attempts an unauthorized instruction Kernel Mode 11 Sometimes called monitor or supervisor mode How is this mode tracked and enforced 7 mode bit hardware Q Is it the operating system software that sets this bit or is the hardware 7 A hardware MSDOS underlying architecture had no mode bit Kernel Mode 111 When CPU switches from 1 program to another program what is going on with the mode bit 0 How does a user program access the file system if it is not allowed to access it directly Through system calls which allow kernel to take over kernel mode Interrupts Extremely important Example Say our program is waiting for data to be printed Do we constantly poll the device to see if it is done Why not Interrupts are a way of getting the Kemel s attention More Interrupts This is notification by hardware Interrupts program executing regardless of what program is doing Interrupts can happen frequently 7 EX one interrupt per character typed You will see some interrupt handler code in Nachos Disabling of interrupts Why Q How do users interrupt the kernel Interrupts System Calls Mode 0 Notice how interrupts system calls and mode work together Timer Interrupts Interrupts can occur at regular intervals to end a process s time slice and hand over control to the kernel 0 Can be used to schedule events Input and Output IO Special instructions for each device A device driver is the interface between the the operating system and the device controller Provides an abstraction Device notifies operating system through interrupts Interrupt vector stores address of interrupt handler for device Index is device number Returns to previously running user program after interrupt handler More IO Some interrupt driven IO causes interrupts for every character One solution is to use DMA Direct Memory Access one interrupt per buffer need for secondary storage we have memory why need secondary storage 7 price of ram too much 7 multiple users shared access 7 memory gets destroyed on power off databases need info to stay around File named collection of related information recorded on secondary storage usually disk sometimes memory Why does disk access take so long relative to memory Ans most important seek time time it takes to move the readwrite head to the proper cylinder Mechanical arm can only move so fast show diagram of platters read head arm etc 0 some rotational latency sectors blocks tracks platters read head Disk Controller disk drive has a disk controller which manages the disk drive on behalf of the operating system Device controllers vary from manufacturer to manufacturer Device drivers usually come with the device and enable communication with controller abstraction device drivers hide differences among device controllers Similarities between memory and disk both can be visualized as a linear array which has to be allocated memory allocate memory to a process disk allocate disk to files given array how do you allocate storage to the files sound like a familiar problem Issues specific to files 0 random access vs sequential access time to move the disk head for random access contiguous writes are much faster 0 files have to store metadata size format timestamp permissions etc 0 access is done in blocks of bytes Alotmore What to look for in different allocation schemes 0 In the allocation schemes in the following slides ask yourself how each scheme performs with respect to fragmentation random access sequential access expandability of files overhead l Contiguous allocation allocate file in a contiguous set of blocks adv simple to implement remember address of rst block and number of blocks in le performance is fast minimal disk seeks for sequential access random is relatively good too disadv grow beyond the bounds of allocated space have to predict needs at le creation time Could result in internal fragmentation if overpredicted eXtemel fragmentation large blocks have trouble nding free space 2 Linked Allocation Linked list of blocks pointer to first block needed Blocks leave space for pointer to next block adv 7 no external fragmentation 7 can grow les easily disadv 7 random access is slow scan entire le to get to desired block No direct access Results in many disk seeks 7 Sequential access could still have many disk seeks 7 pointer overhead 7 what ifwe lose 1 block 3 FAT file allocation table used in dos and early Windows alternative to linked move pointers out of the blocks and into a central table in memory like an array each entry has pointer to next scan memory rather than scanning the disk blocks Much faster drawback need entire table in memory large amount of space Size is proportional to disk size 4 Indexed allocation allocate array to hold pointers to physical block adv 7 allocate in memory at moment le is used how does this compare to FAT Why is it better 7 random access is easy Only 1 lookup to access nth block how many accesses for FAT 7 Low fragmentation disadv 7 blocks can still be allocated randomly over disk Seek time multi level index I Nodes in UNIX 1 node short for index node broken into 3 parts l metadata 2 some actual data 3 pointers to disk blocks Roughly 7 if le is small data of le is stored within inode 7 if le is larger than data section of inode use xed pointers to data blocks direct pointers more inodes after dataspace used in inode and in direct pointers os allocates new block of only direct pointers If file grows even larger gtindeX block pointing to another indeX block End effect is random access of smaller files is good since store within the inode itself but can handle really large files without being inefficient


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Anthony Lee UC Santa Barbara

"I bought an awesome study guide, which helped me get an A in my Math 34B class this quarter!"

Jim McGreen Ohio University

"Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.