For this assignment, and all written homework assignments, you are welcome, and encouraged, to work in small groups (2 or 3 students) either trying to solve the problems together or trying to verify each other's solutions prior to submitting them. If you solve the problems as a group, you should submit your own write-up of the assignment and list the other students you worked with.
(gdb) print/x 1234 # print out decimal value 1234 as hexidecimal $1 = 0x4d2 (gdb) print/t 1234 # print out decimal value 1234 as binary $2 = 10011010010 (gdb) print/d 0x4d2 # print out hexidecimal value 4d2 as decimal $3 = 1234 (gdb) p/d 0b10011010010 # print out binary value 10011010010 as decimal $4 = 1234 (gdb) print/t 0x4d2 >> 3 # print out binary result of bit shifting 4d2 right by three $5 = 10011010 (gdb) print/x 0x4d2 + 100 # print out hexidecimal result of adding decimal 100 to hex 4d2 $6 = 0x536 (gdb) print/x 0x4d2 + 0x100 # print out hexidecimal result of adding hexidecimal 100 to hex 4d2 $7 = 0x5d2
Examine Linux's support for linked lists. The interface is defined in include/linux/list.h, and uses of lists can be found throughout the kernel source. In particular, look at code that moves task_struct structs from list to list.
Assume that the following struct definition exits:
struct test_struct { int x; struct list_head list; };USING ONLY FUNCTIONS AND MACROS from list.h to manipulate the list parts (and don't use the __ versions of functions), for each of the following operations: (1) list the C code fragment that performs the operation AND (2) draw a picture of memory that is the result of performing the operation if it changes either list in either way from the previous operation (label all fields in all structs and show their values, draw pointers fields as arrows to what they point to not as numeric address values):
process arrival time CPU burst size ------- ------------ -------------- P1 0 10 P2 3 4 P3 4 6 P4 5 8 P5 6 4
$ cat foo | grep blah