



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Notes; Professor: Gupta; Class: System Programming; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Fall 2008;
Typology: Study notes
1 / 5
This page cannot be seen from the preview
Don't miss anything!




I. C Programming
Waiting Time: Total time a process is in the Ready queue CPU Utilization: CPU_cycles/total_CPU_cycles_per_unit Throughput: # processes completing execution per unit time
Section III: Memory Allocation 3.1) Consider the following code: 01: 02: 03: 04: 05: 06: 07: 08: 09: 10: 11: 12: #include <stdio.h> int main(int argc, char** argv) { int* a = malloc(sizeof(int)); void* b = &a; void* c = a; void* d = *a; return 0; } Let us assume that the stack memory starts at the address 1000 and counts up while the heap memory starts at the address 2000 and counts down. Assuming no padding or extra memory allocations has been done before reaching Line #5: Where is the variable stored in memory? What is the memory address that the variable is pointing to? a (^) 1000 2000 b (^) 1004 1000 c (^) 1008 2000 d (^) 1012 undefined 3.2) Consider the following structure: 01 02 03 04 05 06 07 typedef struct __myStruct { int myValue, yourValue; char myChar; char *yourString; double yourDouble; } myStruct; The following assumptions are given: A A A A A sizeof(char) = 1 sizeof(int) = 4 sizeof(float) = 4 sizeof(void) = 4 sizeof(double) = 8 What is the return value of sizeof(myStruct)? Answer: 4+4+4+4+1=