OS Structure & ProcessesFoodundgedankAdministrativeA Friendly DeceptionHost/Hostess ProblemUsers, Programs, ProcessesPrograms As Process Collectionsgcc exampleSo What Is A Process?What Does This Program Do?Here’s The OutputInstances Of ProgramsSo What’s In A Process?Consider How To Read a FileWhich is a System Call and WhyWhat State Is Implied?Some Insight Into OSSlide 18Examining Those Other ParametersRemember This?Address SpaceSome DefinitionsMore Address SpaceOne Common LayoutKernel StackIs The Kernel A Process?What Other Options Possible?OS Structure & Processes 1OS Structure & ProcessesOS Structure & ProcessesVivek PaiVivek PaiCOS 318COS 318September 19, 2002September 19, 2002OS Structure & Processes 2FoodundgedankFoodundgedankYou’re the host/hostess of a banquet hall that has You’re the host/hostess of a banquet hall that has accidentally been double-booked. It has three accidentally been double-booked. It has three rooms – the large dining room, the cocktail room, rooms – the large dining room, the cocktail room, and a small buffet line room.and a small buffet line room.If each guest is given a card with the room layout If each guest is given a card with the room layout with table numbers, and the guest’s own table with table numbers, and the guest’s own table number, how can you solve this problem?number, how can you solve this problem?What issues are involved regarding the sizes of the What issues are involved regarding the sizes of the two groups?two groups?OS Structure & Processes 3AdministrativeAdministrativeFirst precept happened, more to comeFirst precept happened, more to come–Friday’s booked – same time, same placeFriday’s booked – same time, same placeYong is this project’s TAYong is this project’s TAProject 1 due 11:59pm Oct 1Project 1 due 11:59pm Oct 1Almost everyone has given me detailsAlmost everyone has given me details–Get me what remainsGet me what remainsNext reading assignment: ???Next reading assignment: ???OS Structure & Processes 4A Friendly DeceptionA Friendly DeceptionHiding informationHiding informationGiving out different information while Giving out different information while appearing to be the sameappearing to be the sameStalling when necessaryStalling when necessaryDrawback? Maybe lots of extra workDrawback? Maybe lots of extra workBenefit: makes life easier for userBenefit: makes life easier for userOS Structure & Processes 5Host/Hostess ProblemHost/Hostess ProblemEach group < 50%Each group < 50%–Have two sets of cards with different Have two sets of cards with different numbering schemesnumbering schemesEach group slightly above 50%Each group slightly above 50%–Slow down the buffet line & entranceSlow down the buffet line & entranceEach group near 100%Each group near 100%–One group in dining room, other in cocktail One group in dining room, other in cocktail roomroomOS Structure & Processes 6Users, Programs, ProcessesUsers, Programs, ProcessesUsers have accounts on the systemUsers have accounts on the systemUsers launch programsUsers launch programs–Many users may launch same programMany users may launch same program–One user may launch many instances of the One user may launch many instances of the same programsame programProcesses are instances of a programProcesses are instances of a program–The “program” can really be a set of processesThe “program” can really be a set of processesOS Structure & Processes 7Programs As Process CollectionsPrograms As Process CollectionsNetscape (output of “ps x”)Netscape (output of “ps x”)–7253 p0 S 0:19.26 /usr/local/lib/netscape/communicator-4.75.bin -irix-s7253 p0 S 0:19.26 /usr/local/lib/netscape/communicator-4.75.bin -irix-s–7280 p0 I 0:00.15 (dns helper) (communicator-4.7)7280 p0 I 0:00.15 (dns helper) (communicator-4.7)gcc (via “gcc –pipe –v”)gcc (via “gcc –pipe –v”)–/usr/libexec/cpp |/usr/libexec/cpp |–/usr/libexec/cc1 |/usr/libexec/cc1 |–/usr/libexec/as, followed by/usr/libexec/as, followed by–/usr/libexec/elf/ld/usr/libexec/elf/ldOS Structure & Processes 8gcc examplegcc exampleYou launch gccYou launch gccIt first launches cpp, cc1, asIt first launches cpp, cc1, asIt then launches ldIt then launches ldEach instance is a process, and each Each instance is a process, and each program actually exists separatelyprogram actually exists separately–You could launch cc1 manually if you wantedYou could launch cc1 manually if you wantedOS Structure & Processes 9So What Is A Process?So What Is A Process?It’s one instance of a “program”It’s one instance of a “program”It’s separate from other instancesIt’s separate from other instancesIt can start (“launch”) other processesIt can start (“launch”) other processesIt can be launched by themIt can be launched by themOS Structure & Processes 10What Does This Program Do?What Does This Program Do?int myval;int myval;int main(int argc, char *argv[])int main(int argc, char *argv[]){{myval = atoi(argv[1]);myval = atoi(argv[1]);while (1)while (1)printf(“myval is %d, loc 0x%lx\n”,printf(“myval is %d, loc 0x%lx\n”,myval, (long) &myval);myval, (long) &myval);}}OS Structure & Processes 11Here’s The OutputHere’s The OutputOS Structure & Processes 12Instances Of ProgramsInstances Of ProgramsThe address was always the sameThe address was always the sameThe values were differentThe values were different–Implies that the programs aren’t seeing each Implies that the programs aren’t seeing each otherother–But they think they’re using the same addressBut they think they’re using the same addressConclusion: addresses are not absoluteConclusion: addresses are not absoluteWhat’s the benefit?What’s the benefit?OS Structure & Processes 13So What’s In A Process?So What’s In A Process?Information about the hierarchyInformation about the hierarchy–What launched itWhat launched it–What it has launchedWhat it has launchedInformation about resourcesInformation about resources–Where is it storing dataWhere is it storing data–What other resources it’s usingWhat other resources it’s usingVarious kinds of mappingsVarious kinds of mappingsOS Structure & Processes 14Consider How To Read a FileConsider How To Read a FileCompare read( ) and fread( )Compare read( ) and fread( )read(int d, void *buf,
View Full Document