Docsity

CSCE 351 Operating Systems Homework: Prerequisite Knowledge Evaluation, Assignments of Operating Systems

Toggle sidebar
bg1
CSCE 351 Operating System Kernels
Fall 2001
Steve Goddard
Homework 0, August 28
(Total of 100 points)
Evaluation of prerequisite knowledge
Due: 12:30pm September 4
____________________________________________________________
The prerequisites for CSCE 351 are CSCE 230, CSCE 230L or CSCE 231, and CSCE
310. This purpose of this assignment is to evaluate your understanding of the prerequisite
knowledge. You may consult any textbook or other resource to complete the assignment,
but do the work on your own. This is not a group project.
CSCE 230 and 230L or 231
1) How is the decimal number 49 represented in
A) Binary?
B) Octal?
C) Hexadecimal?
D) Base 7?
Try to do this one without a calculator :)
2) Why should the value of the program counter be updated before an instruction is
executed? (Hint: What instructions change the value of the program counter as part
of their execution? Would it make a difference if the program counter were updated
after these instructions had been “performed?”)
3) What addressing mode would you use if you wanted to implement a stack in
assembly language? Why?
4) Suppose procedure A calls procedure B, and procedure B calls procedure C. Assume
that register R5 is used for linking; that is, register R5 contains the address by which
any called procedure returns to its calling procedure. What must procedure B do so
that it can send a return address to C without losing the return address it needs to
return to A? Give the assembly instructions by which B could do this.
pf3
pf4

Partial preview of the text

Download CSCE 351 Operating Systems Homework: Prerequisite Knowledge Evaluation and more Assignments Operating Systems in PDF only on Docsity!

CSCE 351 Operating System Kernels

Fall 2001

Steve Goddard

Homework 0, August 28

(Total of 100 points)

Evaluation of prerequisite knowledge

Due: 12:30pm September 4

____________________________________________________________

The prerequisites for CSCE 351 are CSCE 230, CSCE 230L or CSCE 231, and CSCE

  1. This purpose of this assignment is to evaluate your understanding of the prerequisite knowledge. You may consult any textbook or other resource to complete the assignment, but do the work on your own. This is not a group project.

CSCE 230 and 230 L or 231

  1. How is the decimal number 49 represented in A) Binary? B) Octal? C) Hexadecimal? D) Base 7? Try to do this one without a calculator :)
  2. Why should the value of the program counter be updated before an instruction is executed? ( Hint : What instructions change the value of the program counter as part of their execution? Would it make a difference if the program counter were updated after these instructions had been “performed?”)
  3. What addressing mode would you use if you wanted to implement a stack in assembly language? Why?
  4. Suppose procedure A calls procedure B, and procedure B calls procedure C. Assume that register R5 is used for linking; that is, register R5 contains the address by which any called procedure returns to its calling procedure. What must procedure B do so that it can send a return address to C without losing the return address it needs to return to A? Give the assembly instructions by which B could do this.
  1. Consider the following state of a MIPS R2000 machine: RegisterRegister 56 containscontains (^10002000) RegisterMemory location 7 contains 1000 3000 contains 2000 MemoryMemory locationlocation 20003000 containscontains (^30001000) All numbers are in octal (base 8) notation. After the following three R2000 assembly instructions are executed from the above initial state, what is the state of the machine? That is, show the contents of regisers 5, 6, and 7 as well as memory locations 1000, 2000, and 3000. ADDILW $5,$7, $6,0($5) 1000 LWADDI $5,$6, 0($5)$7, 1000 ADD $7, $6, $ Keep all numbers in octal (base 8) notation.

CSCE 310 (and 235 by transitivity)

Consider the following definitions for functions that operate on a list L. A) End( L ). Return the position following position n in an n -element list L. B) INSERT( x, p, L ). Insert x at position p in list L , moving elements at p and following position to the next higher position. That is, if L is a 1 , a 2 , … an , then L becomes a 1 , a 2 , …, ap-1, x, ap, …, an. If p is END( L ), then L becomes a 1 , a 2 , …, an, x. If list L has no position p , the result is undefined. C) RETRIEVE( p,L ). This function returns the element at position p on list L. The result is undefined if p = END( L ) or if L has no position p. D) DELETE( p,L ). Delete the element at position p of list L. If L is a 1 , a 2 , … an , then L becomes a 1 , a 2 , …, ap-1, ap+1, …, an. The result is undefined if p = END( L ) or if L has no position p. E) NEXT( p,L ) and PREVIOUS( p,L ) return the positions following and preceding position p on list L. If p is the last position on L , then NEXT( p,L ) = END( L ). NEXT is undefined if p is END( L ). PREVIOUS is undefined if p is 1. Both functions are undefined if L has no position p. F) FIRST( L ). This function returns the first position on list L. If L is empty the position return is END(L). G) PRINTLIST(L). Print the elements of L in the order of occurrence.

Consider the following tree:

  1. Answer the following questions about the tree. A) Which nodes are leaves? B) Which node is the root? C) What is the parent of node B? D) Which nodes are children of B? E) Which nodes are ancestors of G? F) Which nodes are descendants of G? G) What are the siblings of G and E? H) Which nodes are to the left and to the right of J? I) What is the depth of node M? J) What is the height of node M?
  2. List the nodes of the tree in a) preorder, b) postorder, and c) inorder.

A

B C D

E F G H I J K

L M N O P Q