Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2013
CSE 2431
HOMEWORK 3
AUTUMN 2016
th
Due: Tue. Sep 29 start of class
Note: we will discuss answers in Sep 29th class. So no late submission is accepted for
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Spring 2014
CSE 2421
AU 2014
Homework 1
Answer Key
1. Google why use assembly language? Specify 3 different websites that answer this question in as many
different ways as possible; and write a short paragraph based on each IN YOUR OWN WORDS (i.e., do NOT
copy/paste)
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Spring 2014
AUTUMN 2014 CSE 2421 LAB2
Assigned: Friday, September 19th
Due Date for TWRF and WF sections: Saturday, September 27th by 11:59PM
Due Date for TR section: Monday, September 30 by 11:59PM
NOTE the different due dates for different sections!
Objectives:
Po
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Spring 2014
Autumn 2012
CSE2421 Systems1
Introduction to LowLevel Programming and Computer Organization
Kitty Reeves
TWRF 12:401:35pm
TWRF 3:003:55pm
1
CSE2421 = Alice in Wonderland
A look into the rabbit hole
http:/code.google.com/p/corkami/wiki/PE101?show=conten
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
CSE 2421
Autumn, 2015
Homework 2
Note: 100 points total. Answers are printed in bold type.
Due Date: Thursday, November 5, at the beginning of class. No email submissions will be accepted without
prior approval. To receive credit, solutions must be clear
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2013
CSE 2421: Systems I
LowLevel Programming and Computer Organization
Fractional Numbers
Encoding and Manipulation
Presentation E
Gojko Babi
Study: Bryant Section 2.4
09172013
Fractional Binary Numbers
Bits right of binary point represent
fractional power
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Spring 2014
CSE 2421
Autumn, 2014
Homework 2 ANSWER KEY CORRECTED
1. Given n, which is the width of the binary representation, and the type of representation (signed or unsigned),
determine how many values can be represented in the given width, as well as the minimum
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2012
/ linklst1.c
#include <stdio.h>
#include <stdlib.h>
int main()
cfw_
struct my_rec cfw_
char firstName;
char lastName;
int employeeID;
struct my_rec *next_rec;
;
/ point to first structure in the list
struct my_rec *headPtr = NULL, *new_rec_ptr, *p;
int my
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2012
AUTUMN 2012 CSE 2421 LAB4
* Assigned: Friday September 28th *
* Due Date: Sunday October 7th by 11:59PM *
Objectives:
Bit Operations
Enumerated data types
Main arguments
Makefiles
REMINDERS and GRADING CRITERIA:
Read these sections from lab1 they havent
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Spring 2014
CSE 2421
Autumn, 2014
Homework 2
Due date:
TuWThF section: Tuesday, November 4, 2014 at the beginning of class
TuTh section: Tuesday, November 4, 2014 at the beginning of class
WF section: Wednesday, November 5, 2014 at the beginning of class
1. Given n,
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2013
CSE 2421: Systems I
LowLevel Programming and Computer Organization
Data Encoding
and Manipulation
Presentation D
Gojko Babi
Study: Bryant Chapter 2
09052013
Memory Organization
32bit
words
Main memory is byte addressable
each byte has its own addres
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2013
CSE 2421
SU 2016
Homework 1 (Homework 1 and 2 combined)
This assignment will count a total of 8% of the course grade, since it is a combination of the work usually
assigned for Homework 1 and Homework 2.
Important reminders: Homework cannot be submitted w
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2012
AUTUMN 2012 CSE 2421 LAB3
* Assigned: Thursday September 20th *
* Due Date: Thursday September 27th by 11:59PM *
Objectives:
Structures
Linked Lists
Redirection file I/O
REMINDERS and GRADING CRITERIA:
Read these sections from lab1 they havent changed.
L
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Swap example
REMINDER: we use pointers so can pass
address since cant pass values back outside
of the function
swap:
void swap(int *xp, int *yp) pushl
movl
cfw_
pushl
int t0 = *xp;
int t1 = *yp;
*xp = t1;
*yp = t0;
/codeswap.c
Register
%edx
%ecx
%ebx
%ea
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Whats next
Computer Systems
A Programmers Perspective
198
The role of the operating system
Protect the computer from misuse
Provide an abstraction for using the hardware
so that programs can be written for a variety
of different hardware
Manage the resour
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Decimal to nondecimal base
Base Conversions
Convert to base 10 by multiplication of powers
100125 = (
)10
Convert from base 10 by repeated division
63210 = (
)8
Converting base x to base y: convert base x to
base 10 then convert base 10 to base y
226
C
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Are you sure?
8
Lets
check
(see sizeck.c)
ANSI rules
Variables of type char are guaranteed to always be one byte.
There is no maximum size for a type, but the following
relationships must hold:
sizeof(short) <= sizeof(int) <= sizeof(long)
sizeof(float)
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Signed vs Unsigned
sign2unsign.c
Casting
Signed to unsigned
Unsigned to signed
* Changes the meaning of the
value, but not its bit representation
Notice, the difference of 16 i.e.
left most bit
Unsigned = 23 = 8
Signed = 23 = 8
CODE
0000
0001
0010
0011
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
B2T integer negation
How determine a negative value in B2T?
Reminder: B2U=B2T for positive values
B2U invert the bits and add one
Twos complement negation
2w1 is its own additive inverse
Other values are negated by integer negation
Bit patterns generate
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Rounding
255
Dividing by powers of 2
Even slower than integer multiplication
Dividing by powers of 2 right shifting
Logical  unsigned
Arithmetic twos complement
Integer division always rounds toward zero (i.e. truncates)
C floattointeger casts round to
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
IEEE floating point
IEEE Standard 754 floating point is the most
common representation today for real numbers
on computers, including Intelbased PC's,
Macintoshes, and most Unix platforms
Limited range and precision (finite space)
Overflow means that val
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Floating Point ranges
While the exponent can be positive or negative, in binary formats it is
stored as an unsigned number that has a fixed "bias" added to it.
Values of all 0s in this field are reserved for the zeros and subnormal
numbers, values of all
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Another Example
, rounded to 24 bits of precision, has:
sign = 0 ;
e=1;
s = 110010010000111111011011 (including the hidden bit)
The sum of the exponent bias (127) and the exponent (1) is 128, so this is
represented in single precision format as
0 10000000
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2015
Resolving Symbols
406
Relocating Code and Data
407
Practice problem 7.1 (pg 662)
SYMBOL TABLE .symtab
Info about functions and global variables
that are defined and referenced in a
program
Does not contain entries for local variables
Understanding the rel
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Summer 2015
Cse243l Homework 1. Solutions July 8, 2015
1. Exercise 3.9 Answer: 8 processes are created
Exercise 3.10 Answer: A=0, B=2603, C=2603, D=2600
Exercise 3.13 Answer: The result is still 5, since only the child updates
its value, while the parent (who is prin
Systems I  Introduction to LowLevel Programming and Computer Organization
CSE 2421

Fall 2013
/Compilation command: Fibon 20
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
unsigned long long int generateFibonacci(int N);
/return fibonacci numbers where N is the number of numbers to generate
int main( int argc, char *argv[])
cfw_
int N,