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: Retha McClure

ComputerSystemsI CSC2400

Retha McClure
GPA 3.74


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 23 page Class Notes was uploaded by Retha McClure on Wednesday October 28, 2015. The Class Notes belongs to CSC2400 at Villanova University taught by Staff in Fall. Since its upload, it has received 9 views. For similar materials see /class/230578/csc2400-villanova-university in ComputerScienence at Villanova University.


Reviews for ComputerSystemsI


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/28/15
Floating point example How is 5 represented in oating point Step 1 express as binary number 1010 Step 2 determine sign bit 5 is positive number so sign bit is 0 Step 3 Determine the exponent by putting number in form lif f x 2exponent 1010 x 22 so the exponent is 2 Step 4 Add 127 to the exponent 2 127 129 Step 5 Convert exponent to binary 129 10000001 Step 6 Determine the fraction part by removing the leading l 010 Step 7 Put the parts together drop the decimal point 0 10000001 01000000000000000000000 Step 8 Double check your result being sure to put the l in front of the fraction part 1010 x 212939127 1 x 22 125x4 5 Floating Point Techniques Dr Thomas Way Question How can I convert a oating point number into the IEEE binary oating point representation For example 138125 Answer Follow these steps Step 1 Express as a binary number For the part to the left of the decimal point use the trick of repeatedly dividing by 2 writing each remainder either 1 or 0 as the next bit from right to left until all you have left is 0 like this 13 2 6 r 1 1 6 2 3 r 0 01 3 2 1 r 1 101 1 2 0 r 1 1101 0 so we are done For the fraction part to the right of the decimal point use a similar trick of dividing by 12 which is the same as multiplying by 2 Here s why we divided by 2 above but will now multiply by 2 here Decimal 329125 3x102 2x101 9 x100 1x10 1 2x10 2 5x10 3 Same as 3x100 2x10 9x1 12810 28100 5281000 Binary 101011 1x22 0x21 1x20 0x271 1222 1x2 3 Same as 1x4 0x2 1x1 0282 128 1288 So you can see that everything to the left of the binary point is factored by powers of 2 while everything to the right of the binary point is factored by powers of 12 When we convert from decimal to binary we are simply factoring out all of the powers of 2 or 12 to get the equivalent binary number Let s convert 08125 by repeatedly multiplying by 2 and removing the 1 or 0 that will be on the left side of the binary point writing each of them as our bits this time writing them from left to right until you have 0 OR you fill up the available number of bits in the IEEE format we can have 23 bits 625 8125 x 2 1 625 x 2 125 11 25 x 2 05 110 5 x 2 10 1101 0 so we are done So the resulting binary number is 1 1 01 1 1 01 Step 2 determine sign bit The number is positive number so sign bit is 0 Step 3 Determine the exponent by putting number in form l fffff x Zexponem 11011101 x 20 move the binary point 3 positions to the left 11011101 x 23 so the exponent is 3 Step 4 Add 127 to the exponent 3 127 130 Step 5 Convert exponent to binary Pad the left end with 0 s to get 8 bits if necessary 130 10000010 Step 6 Determine the fraction part of the binary number we converted to in Step 3 by removing the leading 1 1011101 Step 7 Put the parts together drop the decimal point 0 10000010 10111010000000000000000 Step 8 Double check your result being sure to put the l in front of the fraction part 11011101 x 2130 m 11011101 x 23 11011101 x 20 23 22 20 2 1 2 2 2 8 4 1 a 1m 13 05 025 00625 13 08125 138125 Computer Systems Fall 2008 Lab Practicum Unix Wizardry Dr Tom Way In Class Sept 17 or 18 2008 Introduction This practical lab activity is designed to increase your understanding of Unix and Linux and of the underlying system through exploration of a number of Unix commands Some amount of detective work and problem solving will be necessary You may work with one or two other students if you like Below try to write the command that accomplishes each of the following tasks along with any other notes you would like to add 1 Login to your Unix account 2 Determine the file type of each of the following Hint type man file usrucb1s binhostname binwhich bin ssh mntatwaycoursesdocument txt tmp Count the characters words and lines in the following file Hint wc E mntatwaycoursesdocument txt r e Count the number of lines with the word shall on them in the same documenttxt file Hint cat grep pipe Computer Systems 1 Unix Wizardry 5 List how many times the word that is used the most occurs in the documenttxt file Hint This one is very challenging Google search sed sort uniq 6 List all users who are currently logged in to the machine that you are on Hint who cut sort 7 List all processes that are owned by you Hint ps grep Computer Systems 2 Unix Wizardry Computer Systems Cache Handout Cache structu re Tag Data Dirty bit Valid bit Each row In the cache is called a W19 0 Valid bit Does this line hold data 7 0 Dirty bit Has the data been modified 7 0 Tag What address are we holding 7 0 Data The actual cached data Typically lines store a number of words Key question 7 Wthh memory words can go in Wthh lines 7 Fully Associative Caches Any word of memory can occupy any cache line When we access memory search the tags for the required address If It39s found we hIt the cache If not we miss For this to be efficient we must be able to search the tags In parallel This requires special expensive hardware Say we have 32 bIt addresses and each line holds 32 bytes An address Is dIVIded as Tag Offset 27 bits 5 bits If a valid line has the correct tag the offset Indicates which byte of the line we require Fully associative example Consider a cache With 8 lines of 2 bytes each for a system With 256 bytes of memory iiiOiOi o Read address 01011101 hit 0x96 0 Read address 10111000 hit 0x58 0 Read address 11010010 miss load 11010010 11010011 Into last line 0 Read address 11010011 miss Need to make spacel Replacement policy Initially every valid bit is O The cache fills as memory is accessed If we miss and the cache is full we need to decide which address to evict from the cache 0 First in First out FIFO Be fair in access 0 Least Frequently Used LFU 0 Random 0 Optimal Evict the address whose next access is furthest in the future unimplementable 0 Least Recently Used LRU Principle that history repeats itself In practice LRU is often used it s easy to implement and quite good 54 Fully Associative cont d Since any cache line can be used for any word fully associative caches make very ef ficient use of available cache space With a good replacement policy and pattern of data accesses to data that fits in the cache is likely to see a performance gain Parallel searching for the tag requires content accessible memory aka associative memory Nontrivial hardware support is required The tags are large and consume consider able memory For large caches the high hardware cost and complexity become prohibitive Direct Mapped Caches A word of memory can only occupy a certain cache line hen we access memory search the corre sponding cache line first Ifthe tag is correct we hit If not we miss Say we have 32 bit addresses each line holds 32 bytes and we have a 4K8 cache 128 lines An address is divided as Tag index Offset 20 bits 7 bits 5 bits The index tells us which line of the cache this word belongs in Addresses With the same index Will share the same cache line Cache is simpler to access but less efficient 55 Direct mapped example Consider a cache With 8 lines of 2 bytes each for a system With 256 bytes of memory o Read address 01011101 hit 0x96 0 Read address 11011100 miss load 11011100 11011101 Into Index 110 displacing current contents 0 Read address 01100011 miss write dirty contents of 001 then load line Direct mapped cont d Direct mapped caches are easy to implement and don t require special support Since the index consumes part of the address less tag space is required The use of the cache may not be extremely efficient as we cannot place cached data freely Consider moving along a pair of arrays in memory If the base addresses occupy the same cache line so do elements at the same index in each array If we re unlucky almost every cache access will be a miss with each load evicting the other array s data 58 Set Associative Caches Idea trade off efficiency of fully associae tive cache against simplicity of direct mappe cache and get a usable compromise Have several but not all cache lines available for a given word Say we have 32 bit addresses each line holds 32 bytes we have a 4K8 cache 128 lines and we use groups of 2 lines So we get 64 groups of lines sets Tag index Offset 2i bits 6 bits 5 bits Such a cache is Zeway set associative A 4eway set associative cache of this size would have 32 groups of 4 lines Access a cache by searching the set of lines at the index in paralle Set associative example Consider a Zeway set associative cache With 8 lines of 2 bytes each for a system With 256 bytes of memory index 00 Ox2A96 o Read address 01011101 hit 0x96 0 Read address 11011100 miss load 11011100 11011101 Into Index 10 o Read address 01100011 miss load 01100010 01100011 Into Index 01 eVIctIng one of the lines Cacheing and Writes We ve mainly discussed reading memory If we write to a cached address 0 Write through Update memory at the same time Slow o Writeback Update memory later Complicated if other CPU s or DIVIA IO also updates memory If we write to an uncached address 0 Writeallocate Choose a line evicting if needed 0 Write noalocate Write to memory do not alter cache Choice depends on whether data written to memory is likely to be read again soon 61 Split Caches Patterns of access to data and instructions are different Cached data displacing cached instructions may cause performance loss Many systems have two separate caches an instruction cache I and a data cache D Coding a lookup table in I cache set table Xgl sll X00 2 00 jmpl g1oO ZgO retl table mov 1 OO mov 1 OO mov 2 OO mov 6 Z00 mov 24 OO There are coherency issues with two caches for self modifying code Sparc provides a flush opcode for ensuring instruction reads see data stores 62 Review The cache stores recently accessed memory locations so as to exploit temporal locality The cache brings in lines of multiple words at one time to allow it to exploit spatial locality 0 Fully associative caches are efficiency but expensive 0 Direct mapped caches are cheap but less efficient 0 Set associative caches are a widely used compromise o Cache writes can be handled in a number of ways 0 Split caches improve performance when instruction and data accesses clash As with all performance decisions the correct type of cache is application dependent 63 CSC 2400 Running New Programs in UniX Exercise 1 Running ls with execl exec1c I include ltstdiohgt include ltunistdhgt include ltsystypeshgt int main iffork O execl binls ls l O waitNULL printf nList completed n return 0 Compile gcc o execl exec1c Run exec1 Output Exercise 2 Running ls with execv exec2c l include ltstdiohgt include ltunistdhgt include ltsystypeshgt int main char cmd3 ls l O char cmd3 cmd0 ls cmd1 l cmd2 O iffork O execv binls cmd waitNULL printf nList completed n return 0 Compile gcc o exec2 exec2c Run exec2 Output Same Exercise 3 Running ls with execlp Try echo PA39139H at the shell prompt You will see a list of directories search paths separated by This is where the shell looks for a command you type in Unlike execl and execv that require the full path for a command execlp and execvp search these directories for the command you specify as a rst argument exec3 c l include ltstdio hgt include ltunistd hgt include ltsystypeshgt int main iffork m execlp ls ls l O not binls wait NULL printf nList completed n return 0 Compile gcc o exec3 exec3c Run exec1 Output Same Exercise 4 Running Another Program I exec4c l executable exec4 ateStC l CXCCUtabIC ateSt int main int mainint argc char argv pid fork printf Got a s argvl ifpid printf Child runsn exec1 atest atest dog 0 printf Child donen else wait 0 printf Parent donen a If execl succeeds what is the output of exec4 b If execl fails what is the output of exec4 c Why would execl fail Exercise 5 Running wc on Multiple Files The word count program we can take as argument a le Whose name is speci ed in the command line For instance the UniX command we 1 filename will print out the number of lines in the le with name lename Write a small program that takes any number of le names as command line parameters For each lename the program should create a child process which a prints out the name of the le b uses execlp to execute the program we 1quot on that le The parent process should not eXit until all processes have eXited exec5c int mainint argc char argvH int i fori O i lt argc i if fork O printf sn argvi execlp wc WC l argvi O exit fori O i lt argc i waitNULL


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

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

Jennifer McGill UCSF Med School

"Selling my MCAT study guides and notes has been a great source of side revenue while I'm in school. Some months I'm making over $500! Plus, it makes me happy knowing that I'm helping future med students with their MCAT."

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."

Parker Thompson 500 Startups

"It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

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.