Operating Systems CS 3100
Weber State University
Popular in Course
Popular in ComputerScienence
This 7 page Class Notes was uploaded by Jamaal Franecki on Wednesday October 28, 2015. The Class Notes belongs to CS 3100 at Weber State University taught by Delroy Brinkerhoff in Fall. Since its upload, it has received 37 views. For similar materials see /class/230777/cs-3100-weber-state-university in ComputerScienence at Weber State University.
Reviews for Operating Systems
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
Lab 3 Review Windows processes structs amp bit elds and bit masks QM Windows Process Creation Command line arguments passed individually I intptrt spawn int mode PWAT or PNOWAT const char cmdname const char argO const char arg1 const char argn NULL QM Windows Process Creation Command line arguments passed in a vector v intptrt spawnv int mode PWAT or PNOWAT const char cmdname full path to command const char argv em Windows Process Creation Arguments passed in a vector v command in path p intptrt spawnvp int mode PWAT or PNOWAT const char cmdname command name only const char argv QM Pointer and Address Operators Pointers are variables that contain memory addresses pointertype specifier variable definitions amp declarations tYPe t gt type p same as below gt type p same as above I amp address of operator returns the address of variables dereference or indirection operator expressions I Operator relationships gt p is assignment compatible with t ie t p gt ampt is assignment compatible with p ie p ampt gt ampvariable 2 variable ISpecial pointers that point to nothing gt NULL gt 0 zero QM Address Operators Memory content vs memory address int i i 0x0a000010 iis unde ned p is 0x0a000010 39 39 Int p ampI p 0x0a000010 0x0a000014 pis unde ned i10 i 0x0a000010 iile pis 0x0a000010 p IS now 10 p 0x0a000010 0x0a000014 p is 10 9 struct Examples struct variables and struct pointers I struct date When int year int mon int day datePtr Idate when date datePtr ISpace is not allocated by struct declarations only by variable definitions I struct declarations often go in header files QM Structure Function Arguments Passing structs by value and by address void printDate1 date D void printDate2date D cout ltlt Dyear ltlt endl cout ltlt Dgtyear ltlt endl cout ltlt Dmon ltlt endl cout ltlt Dgtmon ltlt endl cout ltlt Dday ltlt endl cout ltlt Dgtday ltlt endl date newYears date newYears 112004 111998 printDate1newYears printDate2ampnewYears QM struct vs union Memory layout and consumption struct demo l I char c double d h gt union constant char c int i double d QM Bit Fields Small oddsized data I Based on structs ie are an extension of the struct syntax I Used to access nonstandard sized data ie not 1 2 4 or 8 bytes usually less than 1 byte 8 bits I Each field is followed by a size measured in bits I Example struct tag unsigned int field1 3 unsigned int field2 7 unsigned int field3 6 QM Bit Field Example U From stat cpp struct modes l 16 7 unsigned int type 7 unsigned int user 3 unsigned int group 3 I I 3 I 3 I 3 I unsigned int others 3 nion shorttomodes 16 I unsigned short statmode struct modes conv mm Bitwise Operations Booleanlike operations I Bitwise operators left and right hand operands are integers Iamp bitwise and 1100amp10011000 bitwise or 1100 1001 1101 Iquot exclusiveor 1100quot10010101 complement 11000011 alblaampb alblalb aIbIaAb a a 00 0 0 0 0 00 0 1 0 01 0 01 1 01 1 0 1 10 0 1 0 1 10 1 1 1 1 1 1 1 1 1 0 QM Bitwise AND Used to extract or unpack information I Bitwise AND with a bitmask is used to mask out or switch bits off I Mask is usually given as a symbolic constant or in hexadecimal or occasionally octal 110110 data 1 N M 1de mask00011111 ill 1 00010110 result QM Bitwise OR Used to encode or pack information I Bitwise OR with a bitmask is used to switch bits on I Mask is usually given as a symbolic constant or in hexadecimal or occasionally octal 10110110 data g4gg 39 mask 11100000 11110110 reSUIt QM
Are you sure you want to buy this material for
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'