CSG112 – Computer Systems Instructor: Peter J Desnoyers Lecture 3 – Part 1 Date: 09/29/2008 Scribe notes by Rohith Shivakumar HOMEWORK ASSIGNMENT • Updated homework assignment is due October 14 th . • Primary parts of the homework assignment are 1. Reading the binary file into memory. 1 st question : Micro program which when compiled is about 30 bytes or so of machine code. You need to open that file and read it into memory starting at the proc1 pointer. Using a function pointer - load something in this memory address, now pretend that it is a pointer to a type of function and call it. 2. Another major piece of code is in parsing a line (Question 3 – implementing a command line) More on this is in the 2 nd README file. Q&A SESSION Every Tuesday from 10 AM – 11 AM, Room 166 WVH. QUESTIONS ON ASSIGNMENT • When you do memory mapping, does it allocate memory? Yes, init_stuff( ) allocates anonymous memory region with the help of mmap( ). In linux if you malloc( ) a large memory location it internally uses mmap( ). • access( ) does error checking before calling the function. CONTEXT SWITCHING • To do context switching, you enter using one stack and leave using a different stack.
9
Embed
CSG112 – Computer Systems Instructor: Peter J Desnoyers ... · Scribe notes by Rohith Shivakumar HOMEWORK ASSIGNMENT • Updated homework assignment is due October 14th. • Primary
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
CSG112 – Computer Systems
Instructor: Peter J Desnoyers
Lecture 3 – Part 1 Date: 09/29/2008
Scribe notes by Rohith Shivakumar
HOMEWORK ASSIGNMENT
• Updated homework assignment is due October 14th
.
• Primary parts of the homework assignment are
1. Reading the binary file into memory.
1st
question : Micro program which when compiled is about 30 bytes or so of machine code. You
need to open that file and read it into memory starting at the proc1 pointer.
Using a function pointer - load something in this memory address, now pretend that it is a pointer to
a type of function and call it.
2. Another major piece of code is in parsing a line (Question 3 – implementing a command line)
More on this is in the 2nd
README file.
Q&A SESSION
Every Tuesday from 10 AM – 11 AM, Room 166 WVH.
QUESTIONS ON ASSIGNMENT
• When you do memory mapping, does it allocate memory?
Yes, init_stuff( ) allocates anonymous memory region with the help of mmap( ). In linux if you malloc( ) a
large memory location it internally uses mmap( ).
• access( ) does error checking before calling the function.
CONTEXT SWITCHING
• To do context switching, you enter using one stack and leave using a different stack.
TODAY’S LECTURE : Concurrent processes
• Processes switching back and forth (even in multi-core CPUs).
• Interrupts can cause execution to switch from one thread of execution to other.
• primary assumption is that these results are serializable.
We will not be able to predict the order in which it takes place.
e.g: - QUEUE
Note: - It has several invariants like most data structures.
• If queue is empty then head = NULL and tail = NULL
• If it has one element then, head and tail points to the same element.
queue(item) val = deque( )
temp = tail; temp = head.next
if temp != NULL head = temp
tail, temp.next = item if temp = NULL
else tail = temp
head, tail = item
• Let us assume that this is the code of a device driver. We have top half of the device driver, the
function that you call basically from the user program. Let this queue up the packets that has to be
sent.
• Let us also assume an interrupt handler which is pulling elements of the queue.