Comma splices
Course intro
CSE 2421 – Systems I
Introduction to Low-level Programming and Computer Organization
Instructor: Mohammad Abu Shattal
Office: 405 Caldwell Lab
Abushattal.1@osu.edu
1
Computer Systems: A Programmer’s Perspective, 3rd Edition, by Randall E. Bryant and David R. O’Hallaron, (Required)
Amazon prices (7/31/19)
Rent $37.67,
Buy used $65.00 + $6.87 shipping,
Buy new $144.08 (hardcover) The paperback (international) version is less expensive, but reviews say there are many typos and that the exercises and answers are different than hardcover and sometimes wrong. Caveat Emptor!
Below are two links with additional information related to the text
http://www.csapp.cs.cmu.edu/
http://csapp.cs.cmu.edu/3e/students.html
This link contains all known errors to the 3rd edition of the text:
http://csapp.cs.cmu.edu/3e/errata.html
(Every text has errors. Editors/authors aren’t perfect.)
Course Textbook(s)
2
Pointers on C, by Kenneth Reek 1997 (Recommended, not required)
Amazon prices (7/31/19)
Rent $ 18.90,
Buy used $ 47.99 + $3.99 shipping,
Buy new $145.80
The paperback (international) version is less expensive, reviews say the quality of the book and printing is really bad, but they don’t complain about content
This textbook geared towards practical development with C.
Course Textbook(s)
3
The syllabus is posted on Carmen.
Reading the Course Syllabus is a required reading assignment for this class. Due date for this assignment is tomorrow.
Choosing to not read and/or retain the information within the Course Syllabus, is not a valid excuse for not knowing the information within it.
Course syllabus
If you have questions or need help, please ask, either during class, by posting on Carmen, or by stopping to see me or one of the graders during their office hours (or by making an appointment).
My office hours and the graders names/office hours are posted on carmen
Slides will be posted to Carmen
Grades will also be posted to Carmen.
Labs and homework will be submitted to Carmen or by email (instructions will follow separately).
Course syllabus highlights
5
I take Ohio State University’s policies regarding Academic Integrity and Misconduct seriously. I expect all of you to take them seriously as well. It’s how we all contribute to keeping the value of your future degree high and in demand by employers.
If you have not yet taken the time to read these links on prohibited conduct, now is the time:
https://trustees.osu.edu/rules/code-of-student-conduct/3335-23-04.html
https://oaa.osu.edu/academic-integrity-and-misconduct/student-misconduct
You should make a point of checking out the Ten Suggestions for Preserving Academic Integrity
Additional Information
I expect this certification to be at the top of each file:
BY SUBMITTING THIS FILE TO CARMEN, I CERTIFY THAT I HAVE PERFORMED ALL OF THE WORK TO CREATE THIS FILE AND/OR DETERMINE THE ANSWERS FOUND WITHIN THIS FILE MYSELF WITH NO ASSISTANCE FROM ANY PERSON (OTHER THAN THE INSTRUCTOR OR GRADERS OF THIS COURSE) AND I HAVE STRICTLY ADHERED TO THE TENURES OF THE OHIO STATE UNIVERSITY’S ACADEMIC INTEGRITY POLICY.
If it’s not there, you may receive 0 points for the assignment
For each assignment you submit for a grade
Your grade for this class will be determined by:
Description Percentage of Grade
Programming Assignments (~6/7) 15%
Homework Assignments (~3-4) 10%
Attendance/Participation/ 5%
In-class Assignments
Midterm 30%
Final Exam – must pass 40%
You must pass the final exam in order to pass the course.
Grading
The course material is divided into two large parts:
Part 1: The C programming language
programming & debugging in C along with the tools to do so
Part 2: Introduction to computer systems and X86-64 assembly language programming & debugging in x86-64 along with the tools to do so
Within the two parts we will address:
Binary, octal, decimal and hexadecimal number representations
Performing mathematical and logical operations on the above
(e.g. addition, subtraction, XOR, AND, OR, L/R shifting)
Topics for the course
How to setup the lab environment we’ll be using for the remainder of the semester
An overview of Java vs. C
Topics for today
You are expected to do all lab work on the stdlinux servers for this class.
You can access stdlinux in two ways:
1. Go to a CSE lab location: info on labs at
https://cse.osu.edu/computing-services/computing-labs/locations-hours
2. Remote access from your own device:
https://cse.osu.edu/computing-services/resources/remote-access
Make sure you can access stdlinux ASAP. You don’t want to run in to problems 2 hours before the due date of an assignment. Any lack of planning on your part is not an emergency or a reason for allowing an exception on my part (on any assignment – not just labs).
Lab environment (for both parts of the course)
I am told by the CSE Help Desk that: when logging in from one of the CSE labs, you “will not need to log in with PulseVPN. Pulse is only necessary to allow access to the CSE environment from machines that aren’t on the network”.
The Engineering Technology Services (ETS) Team has added additional resources to support you. We created a new Help Desk area in Baker 392 to expand poster printing support that is adjacent to several of the ISE and CSE labs. There will be full-time ETS staff and ETS student workers to provide assistance.
https://ets.osu.edu/
Phone: (614) 688-2828
Email: etshelp@osu.edu
Business Hours:
M-F 8:00 A.M.-5:00 P.M.
Lab environment (cont.)
You will want to use:
PulseVPN
FastX2 (or PuTTy)
See the remote access information at the CSE link on the preceding slide to get instructions. Read the sections labeled UNIX and FastX2
To minimize potential problems, formally logout of FastX and PulseVPN.
Sometimes, if you just click window out, the connection doesn’t shut down correctly on stdlinux
This causes stdlinux to think you have multiple sessions up and at some point, you “hit the limit” and it won’t let you create any more sessions. (And, you don’t think you have any current sessions up.) Experience in past semesters says that this will happen as you try to log in to stdlinux that final time to submit your labs as the due date/time approaches.
More on remote access:
C Labs for this course must build on stdlinux with gcc –ansi -pedantic
Do not use IDEs – they will be more trouble than they are worth!
A lot of students write a perfect lab in Windows with Visual Studio, etc.,
. . . then fail the lab because they can’t get it to compile in a Linux environment
It’s not worth the time to convert from one to the other, and you lose the benefits of learning to work in a Linux/Unix environment, which you may very well need to do later in your career.
Note: If you do things this way, any resulting problems are your responsibility. I will not help you with IDE problems nor will I help you debug a program using an IDE.
More on Labs: Caution!
Excellent tools: IDE, CI, etc.
Many 3rd party libraries
Lots of documentation
Platform independent
Reasonable performance
Well thought out exception handling
Native Threads
Easy to Learn
Lots of available jobs
Why OSU teaches Java first
Classes and the advantages of OOP.
Memory management (garbage collection)
Security (partly related to the absence of pointers)
Larger libraries (no need to re-create the wheel)
Ability to put something together more quickly that works and *does* something
I assume that each of you is proficient at programming in Java
This means you know how loops work, you know a reasonable amount of programming logic, and you know how to split functionality between a main() program and methods
16
You might all be asking yourselves these questions:
Why study C?? It’s old technology, Java and C++ are what’s being used now!
See the next few slides
Why would ANYONE want to study assembler in this day and age?!?!?!?
Assembler language is still often used for performance-critical parts of a program
Interfacing with or fixing code for which you have no source code
Assembler code knowledge is indispensable when diagnosing malware (security jobs)
I’m not an EE. I’m not planning to create circuit boards. Why do I need to know about processor architecture?
If you are going to program, knowledge of the hardware makes you a better programmer.
Some motivation for Systems I course content
17
TIOBE Index for December 2017 (yes, I know this is a little dated now)
December Headline: Kotlin and C candidates for programming language of the year
The programming languages Kotlin and C seem to be the only candidates to become programming language of the year 2017. TIOBE will announce the winner of this award next month. Thanks to the boost of small software devices and the increase of low level software in the automotive industry, the C programming language gained a lot of popularity in 2017. C is one of the oldest programming languages alive. Its main competitor for the award, Kotlin, is relatively new. It was released in 2011 by JetBrains. Kotlin is a language that can run on a Java VM and has become popular because it has been accepted as an official Android language.
https://www.tiobe.com/tiobe-index//
Why study C?
18
The TIOBE Programming Community index is an indicator of the popularity of programming languages. The index is updated once a month. The ratings are based on the number of skilled engineers world-wide, courses and third party vendors. Popular search engines such as Google, Bing, Yahoo!, Wikipedia, Amazon, YouTube and Baidu are used to calculate the ratings. It is important to note that the TIOBE index is not about the best programming language or the language in which most lines of code have been written.
The index can be used to check whether your programming skills are still up to date or to make a strategic decision about what programming language should be adopted when starting to build a new software system. The definition of the TIOBE index can be found here: https://www.tiobe.com/tiobe-index//
Aug 2019 Aug 2018 Programming Language Ratings Change
1 1 Java 16.028% -0.85%
2 2 C 15.154% +0.19%
3 4 Python 10.020% +3.03%
4 3 C++ 6.057% -1.41%
5 6 C# 3.842% +0.30%
6 5 Visual Basic .NET 3.695% -1.07%
7 8 JavaScript 2.258% -0.15%
8 7 PHP 2.075% -0.85%
9 14 Objective-C 1.690% +0.33%
10 9 SQL 1.625% -0.69%
Current TIOBE Rankings
19
C is universal;
C runs directly on the hardware, rather than requiring an Interpreter which slows down the execution speed (i.e. C runs faster than just about anything except assembly language);
It has a very powerful and varied repertoire of operators;
Elegant syntax
Ready access to the hardware when needed;
Compile once, run anytime;
Preferred language for implementing other programming languages and compilers;
Lots of C code still out there. Make yourself more marketable.
Why Study C?
20
“High Level” languages provides everything the programmer might want to do already provided for in the language (e.g. Java)
C is considered a “Middle Level” programming language. It has the capability to access the system’s low level functions. It provides building blocks that you will need to produce the results your are being asked to provide.
“Low Level” languages (assembler) provide nothing but access to the machines basic instruction set.
3/7/2016 blog https://www.pluralsight.com/blog/software-development/why-every-programmer-should-learn-c
6/19/2019 Infoworld Article: https://www.infoWorld.com/article/3402023/why-the-c-programming-language-still-rules.html
Why Study C?
Lower Level: much more is left for you to do (usually more efficiently)
Unsafe: you can set your computer on fire
C standard library: much smaller
Similar syntax: can both help and confuse
Not object oriented (it’s functional): paradigm shift – this might be the hardest part
Not Java Time! Welcome to C!
Better question:
What are the advantages of C, and what are its disadvantages, and likewise, what are the advantages of Java, and its disadvantages?
Where does each language make the most sense, as a tool I can use, given its strengths and weaknesses?
What’s better? A hammer or a screwdriver?
Doesn’t the answer depend upon what you’re trying to accomplish?
Based on this assessment, we can make good choices about which language might be the best in a given situation. This course will, hopefully, give you information to help make this type of decision.
So which is better, Java or C?
Hammer vs Screwdriver
23
Cell phones
PDAs
desktop computers
Web servers
Application servers
Rapid development
Java is a good application for:
They do exactly what you tell them to do
No built in memory management (memory leaks….)
C allows the use of pointers, which are powerful
#1:require care to use effectively and
#2:rigorously logical thinking to use correctly.
C is compiled to machine code (in several steps), so the compiled program runs directly on the hardware.
Wonderfully, yet irritatingly, obedient – you type something incorrectly, and it has a way of compiling fine and just doing something you don’t expect at run-time.
Think of a 3 year-old who does exactly what you tell them rather than what you meant.
No overhead, just raw power/speed
Advantages of C (and assembly language, later in the course)
25
Performance Critical Applications
games: but C++ is more appealing
codecs
Web browsers (there’s debate within the industry here)
Operating Systems (Linux is mostly in C)
Compilers
Programs that operate hardware (e.g. robotics)
Although some applications use assembler code for this
Networking
Internet of Things
Embedded Systems
Just about anything where raw power and speed are required
C is a good application for:
26
Another purpose of this course is to get a systems level view of how computer programs are written and run.
We want you to develop a better understanding of the systems software (compilers, assemblers, linkers) which plays a role in how programs actually run on the hardware.
The way that C language programs are converted to machine language instructions which can actually run on hardware, provides a “deeper” view of the relationship between a high level language program and its execution on the hardware.
When we learn assembly language in the latter part of the course, we will also develop a better understanding of the hardware itself, and how it executes a program.
Other reasons to learn C in the context of the goals of this course