Microsoft PowerPoint – 1_Intro_To_Course
O
SU
C
SE
2
42
1
J.E.Jones
CSE 2421 – Systems I
Introduction to Low-level Programming and Computer Organization
Janis Jones
jones.
http://clipartmag.com/cartoon-sunshine-pictures
https://creativeartslifestyle.com/all-products/word-stencil-welcome-english-vintage-arched-9-1-2-x-2-5-8-word-size/
O
SU
C
SE
2
42
1
J.E.Jones
Computer Systems: A Programmer’s Perspective, 3rd Edition, by Randall E. Bryant
and David R. O’Hallaron, (Required)
◦ 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.)
Pointers on C, by Kenneth Reek 1997 (Recommended, not required)
◦ This link contains all know errors for Reek:
https://www.cs.rit.edu/~kar/pointers.on.c/errata.html
If you chose not to purchase Reek (since it was recommended but not required), keep a note to the title
and author. If you end up in a position where C is a part of your daily responsibilities, buy it. It’s the
best book I’ve seen. There is a copy of this text in the Engineering Library.
O
SU
C
SE
2
42
1
J.E.Jones
The syllabus is posted on Piazza.
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 or
any other PDF in the Piazza Resource section “Absolutely Must Read”, is not a
valid excuse for not knowing the information within it.
If you ask a question that is answered by information withing any of those
documents, I will not bother to respond to your email. GO THERE FIRST!
O
SU
C
SE
2
42
1
J.E.Jones
If you have questions or need help, please ask, either during class, by
posting on Piazza, or by Zoom meeting with 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 (will be) posted on
Piazza
I do not check email on Carmen, use Piazza or jones.
Most slides will be posted to Piazza
Grades will only be posted to Carmen.
Labs and homework will be submitted to Carmen.
There are no make-ups for in-class assignments (note caveats in
syllabus)
O
SU
C
SE
2
42
1
J.E.Jones
If you see a link to anything within the slides or any of the items on Piazza under
Resources, the information found there is “fair game” for questions on the
midterm and/or the final. I’m notorious for putting a few questions about them on
the midterm and final to help me determine who gets the A’s and who gets
something less.
There are required readings specified in the Date Calendar. Don’t procrastinate.
Reading textbooks is definitely not one of my favorite things. If I don’t like to
do something, I won’t have you do it. If I’m telling you to read something, it’s
because I consider it to be a significant help with respect to you being able to
understand the concepts in this class.
O
SU
C
SE
2
42
1
J.E.Jones
• Today:
• CSE 2421 Syllabus
• http://tldp.org/LDP/intro-linux/html/sect_01_01.html
• http://www.diffen.com/difference/Linux_vs_Unix
• Friday:
• Reek: Chapter 14 (taking a week or so to finish this one will work out)
• B&O:Chapter 1 thru Section 1.3,
• Reek:Chapter 5 through5.1.3, 5.3 through the end of the chapter
• Monday:
• B&O:Chapter 2 thru Section 2.1.2;
First Few Required Readings
O
SU
C
SE
2
42
1
J.E.Jones
Copyright disclaimer
◦ The materials used in connection with this course may be subject to copyright protection and are
only for the use of students officially enrolled in the course for the educational purposes
associated with the course. Copyright law must be considered before copying, retaining, or
disseminating materials outside of the course.
◦ This means that if you upload any course content to Chegg, CourseHero, etc., you are violating
copyright law.
◦ Be aware that posting lab, homework, or exam questions from this course to Chegg or
other coursework help web sites or searching for and reading answers to any question
that are already posted is also considered academic misconduct.
◦ Note that many of these sites cooperate with OSU with respect to identifying instances
of academic misconduct. Ask a bunch of students that took Chemistry Spring ’20 about
that.
If you have SLDS accommodations, get that information to me ASAP.
Accommodations are not applied retroactively.
O
SU
C
SE
2
42
1
J.E.Jones
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. Students who choose to violate this policy
are stealing the integrity of the degree everyone else works hard to earn.
Please be sure to familiarize yourself with the OSU academic misconduct rules and policies which
include examples and details defining academic misconduct: http://oaa.osu.edu/coamfaqs.html.
It is your responsibility as a student to be aware of actions that are considered prohibited by
the university. The COAM committee does not consider not knowing that a particular behavior is
considered academic misconduct a valid excuse.
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
O
SU
C
SE
2
42
1
J.E.Jones
ACADEMIC INTEGRITY (ACADEMIC MISCONDUCT)
Academic integrity is essential to maintaining an environment that fosters excellence in teaching, research, and other
educational and scholarly activities. Thus, The Ohio State University and the Committee on Academic Misconduct
(COAM) expect that all students have read and understand the University’s Code of Student Conduct, and that all students
will complete all academic and scholarly assignments with fairness and honesty. Students must recognize that failure to
follow the rules and guidelines established in the University’s Code of Student Conduct and this syllabus may constitute
Academic Misconduct.
The Ohio State University’s Code of Student Conduct (Section 3335-23-04) defines academic misconduct as: Any activity
that tends to compromise the academic integrity of the University or subvert the educational process. Examples of
academic misconduct include (but are not limited to) plagiarism, collusion (unauthorized collaboration), copying the
work of another student, and possession of unauthorized materials during an examination. Ignorance of the University’s
Code of Student Conduct is never considered an excuse for academic misconduct, so I recommend that you review the
Code of Student Conduct and, specifically, the sections dealing with academic misconduct.
If I suspect that a student has committed academic misconduct in this course, I am obligated by University Rules to report
my suspicions to the Committee on Academic Misconduct. The committee determines whether there has been misconduct.
If COAM determines that you have violated the University’s Code of Student Conduct (i.e., committed academic
misconduct), the sanctions for the misconduct could include a failing grade in this course and suspension or dismissal from
the University.
If you have any questions about the above policy or what constitutes academic misconduct in this course, please contact me
or read the OSU links on the previous slide.
O
SU
C
SE
2
42
1
J.E.Jones
I expect this certification to be at the top of each file:
BY SUBMITTING THIS FILE TO CARMEN, I CERTIFY THAT I
HAVE STRICTLY ADHERED TO THE TENURES OF THE OHIO
STATE UNIVERSITY’S ACADEMIC INTEGRITY POLICY WITH
RESPECT TO THIS ASSIGNMENT.
If it’s not there, you may receive 0 points for the assignment. At a
minimum, you will not get full points for your submission.
O
SU
C
SE
2
42
1
J.E.Jones
Your grade for this class will be determined by:
Description Percentage of Grade
Programming Assignments* 12%
Homework Assignments* 12%
In-class Assignments* 6%
Midterm 30%
Final Exam – must pass 40%
You must pass the final exam in order to pass the course.
*These items prepare you for the Midterm and Final
O
SU
C
SE
2
42
1
J.E.Jones
The principal goal of education is to create men and
women who are capable of doing new things, not simply
repeating what other generations have done
– Jean Piaget
In other words, men and women who can “think” rather
than those who can “memorize answers”. If I could tell
you everything you needed to know to work in IT for the
next 40 years, I would have a different job*.
– Janis Jones *and I’d probably be living in Tahiti.
As an educator, I can only open the door. You, as a
student, must decide to walk in.
– Unknown
O
SU
C
SE
2
42
1
J.E.Jones
The principal goal of education is to create men and
women who are capable of doing new things, not simply
repeating what other generations have done
– Jean Piaget
In other words, men and women who can “think” rather
than those who can “memorize answers”. If I could tell
you everything you needed to know to work in IT for the
next 40 years, I would have a different job*.
– Janis Jones *and I’d probably be living in Tahiti.
As an educator, I can only open the door. You, as a
student, must decide to walk in.
– Unknown
This takes effort!
JJ1
Slide 13
JJ1 Janis Jones, 5/10/2021
O
SU
C
SE
2
42
1
J.E.Jones
OSU expects you to budget 2 hours of time per semester hour of additional
work outside of the hour for class. That means for a 4 semester-hour course,
you should expect 4 hours of class time each week and (on average) 8
additional hours of work each week. If you are having difficulty with any of
the topics, this could increase for you. With this being a shortened summer
semester and doing a little math (100 minutes (Summer class time per
day) divided by 55 (SP/AU class time per day) = 1.82. 2 hours outside of
class for SP/AU multiplied by 1.82 = 3.64) means that for Summer you
should expect to put in 3.64 hours/semester hour each week. That means
for this 4-hour class, you should expect to spend 14.56 additional hours
working on this material EACH WEEK.
If you get behind in this course, it is not impossible to catch up, but it is
difficult.
O
SU
C
SE
2
42
1
J.E.Jones
That you make a reasonable effort to be in class
That you attend class prepared and pay attention while here
That you ask questions if you don’t understand what’s being discussed in class
That you tell me what you DO know prior to asking a question so that I know where to
start the explanation.
◦ Many topics we discuss spiral; give me a baseline on where to start.
◦ If you don’t do this, expect me to ask you questions before answering yours so that I can ferret out this
information, especially in office hours or when you ask me an email or piazza question.
Ensure that there is a photo of you in your Carmen and Zoom profile that clearly shows
your face and only your face. I love dogs/cats/scenic photos but that doesn’t tell me
who you are. Not only do I want the social interaction, but so do your classmates. If
you choose not to do so, expect your semester grade to be affected.
O
SU
C
SE
2
42
1
J.E.Jones
That sometimes I will be going over concepts that you already know and understand
That I will be fair
◦ “fair” means that I will grade your work consistently with everyone else’s
◦ “fair” means that any extra credit will be offered to everyone
◦ “fair” means that, if there are extenuating circumstances, then the exception will apply to everyone with the
same circumstances
◦ “fair” means that I don’t sanction exceptions for procrastination or not putting in the effort for this class that
everyone else has
That I will be serious about the work
That the course material builds off previously discussed topics
◦ Unfortunately, this means that if you don’t stay current, your problems with this class will likely snowball
To be successful, you must put in the effort
Bad Jokes. It’s the only kind I have. It’s only for one semester; you’ll live through it.
O
SU
C
SE
2
42
1
J.E.Jones
If you were successful in Foundations I and/or
Foundations II, then you can easily be successful here.
This material isn’t any harder, it’s just different.
Some of the material in this class that seems to give
students trouble used to be taught in the “Intro to
Computing” class back in the Dark Ages.
◦ It’s not taught there now because we start with “higher
level” stuff and work our way down.
O
SU
C
SE
2
42
1
J.E.Jones
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
Sprinkled liberally within the two sections:
◦ Binary, octal, decimal, hexadecimal and ASCII number representations
◦ Performing mathematical and logical operations on the above
(e.g., addition, subtraction, XOR, AND, OR, L/R shifting)
Anything else related to these topics that I can find that will make you better
employees and better computer scientists
O
SU
C
SE
2
42
1
J.E.Jones
The concepts taught in Systems 1 are ones that the CSE department considers vital to your future success
in your upper-level courses and your future career in IT. After spending over 35 years in the IT business
community and because I still regularly speak with my peers from companies such as Google, YouTube,
Chase, Nationwide Insurance, Lockheed Martin, NASA and others, I know that the CSE department’s
opinion is valid. I assign semester grades based on your ability to demonstrate a firm grasp of Systems 1
concepts through your performance on the homework/labs/exams. Passing someone who can not do this
work will ultimately do more harm to him or her than the (short term) good of allowing you to chalk up
another class on the “Done” list. I would not purposefully do that to anyone that I cared about and –
believe it or not – I care about every single one you.
I realize that some of you might consider this to be a harsh, unfair and uncaring position to take. I hope
that at some point in the future, you will realize that it is the exact opposite.
O
SU
C
SE
2
42
1
J.E.Jones
Lack of structure and procrastination are your enemies!
This article may help you:
Why you’re procrastinating more
By Alexander Besant, Editor at LinkedIn
If you find yourself procrastinating more these days, you’re likely not alone, says a report in Fast Company. Our current crisis may
have something to do with it. Factors like added stress and anxiety, a lack of mental preparation for work that comes with a
commute, massive outside stressors making work seem trivial by comparison and less friendly socializing, among other things, feeds
our need to procrastinate as a coping mechanism.
Here are some articles about overcoming procrastination:
• Managing the discomfort of starting
• The importance of mindfulness
• Focusing on just one thing
• Break work into smaller pieces
• Minimize distraction
If you want to see the original article, go here: https://www.linkedin.com/feed/news/why-youre-procrastinating-more-4901532/
You may find other useful information in the comments that accompany the article. I did.
Here are a couple others:
◦ https://www.fastcompany.com/90527143/5-reasons-why-youre-probably-procrastinating-more-right-now
◦ Procrastination isn’t about being lazy; it has way more to do with our self‐worth. Here’s why:
https://ideas.ted.com/tired‐of‐procrastinating‐to‐overcome‐it‐take‐the‐time‐to‐understand‐
it/?utm_source=linkedin.com&utm_content=2020‐7‐16&utm_medium=referral&utm_campaign=social
O
SU
C
SE
2
42
1
J.E.Jones
How to setup the lab environment we’ll be using for the remainder of
the semester
An overview of Java vs. C
◦ After tomorrow, the “Java” word in this classroom will only refer to coffee
A quick summary of the lab assignment if we have time
O
SU
C
SE
2
42
1
J.E.Jones
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
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”.
I cannot help you with remote access issues. Your best bet is to seek help at an ETS Help Desk if you
have problems.
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).
Highly Recommended!!
O
SU
C
SE
2
42
1
J.E.Jones
The Engineering Technology Services (ETS) Team is there to support you. There is a Help
Desk area in Baker 392 to expand poster printing support that is adjacent to several of the
ISE and CSE labs.
Online Zoom help:
◦ http://go.osu.edu/etsvirtualhelpdesk
◦ 8am-5pm Monday-Friday
ETS’s main Help Desk area, 1012 Smith Lab
◦ Phone: (614) 688-2828
◦ Email:
◦ Service Desk Location: 1012 Smith Lab
◦ Business Hours: M-F 7:00 A.M.-5:00 P.M.
Don’t forget you also have access via The Buckeye Bar: https://ocio.osu.edu/help/locations
◦ Currently by appointment only
◦ 24-hour support via phone/online
O
SU
C
SE
2
42
1
J.E.Jones
You will want to use:
◦ PulseVPN
◦ FastX2 or FastX3 (maybe, Putty instead if on a Mac)
◦ 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 response time issues, use xterm windows. DO NOT use MATE.
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, CSE Help Desk has
already closed for the night, and I’m asleep.
O
SU
C
SE
2
42
1
J.E.Jones
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.
A few students in prior semesters chose not to heed this warning and ended
up with no points on labs they put a lot of work in.
O
SU
C
SE
2
42
1
J.E.Jones
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
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
O
SU
C
SE
2
42
1
J.E.Jones
I assume that each of you is proficient at
programming in Java and/or C++
This means you know how loops work and you know
a reasonable amount of programming logic
As you work in the industry, you will have to change
the programming language you are using from time to
time. It’s part of the deal. And it’s not hard.
O
SU
C
SE
2
42
1
J.E.Jones
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 or in cybersecurity applications
◦ Interfacing with or fixing code for which you have no source code
◦ Assembler code knowledge is indispensable when diagnosing malware (security jobs)
◦ Quote from a student email I got last year: “This summer I am interning with the Cyber Security team at GE Aviation, and it turns
out that hackers love to use assembly. I’ve actually spent quite a bit of time learning how to reverse engineer the assembly code! ”
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
Are you a “one-trick pony”? Do you want to be? Where you be in 10 years? 20 years? 30 years? Is it
where you will want to be?
O
SU
C
SE
2
42
1
J.E.Jones
TIOBE Index for December 2019
December Headline: The winners continue to win
TIOBE will announce the programming language of the year next month. There are 4
candidates for this title: Java (+1.3%), C (+1.8%), Python (+1.9%) and C# (+1.4%).
These 4 languages are all in the top 5. Only C++ lost some ranking points in 2019.
Python is top favorite for the title. It was already programming language of the year
2018, but its popularity keeps growing. This is mainly due to the lack of programmers
in the world and the ease of learning this language if compared to other languages. C is
also doing well thanks to the rise of Internet of Things. Why Java and C# are doing well
is unclear, but it would be the first time that C# becomes the programming language of
the year. Let’s see what will happen next month!
O
SU
C
SE
2
42
1
J.E.Jones
TIOBE Index for January 2020
January Headline: Programming Language C
awarded Programming Language of the Year 2019*
◦ Everybody thought that Python would become TIOBE’s programming language of the
year for the second consecutive time. But it is good old language C that wins the award
this time with a yearly increase of 2.4%. Runners up are C# (+2.1%), Python (+1.4%) and
Swift (+0.6%). Why is the programming language C still hot? The major drivers behind
this trend are the Internet of Things (IoT) and the vast amount of small intelligent
devices that are released nowadays. C excels when it is applied to small devices that are
performance-critical. It is easy to learn and there is a C compiler available for every
processor. Congratulations to C! Other interesting winners of 2019 are Swift (from #15
to #9) and Ruby (from #18 to #11). Swift is a permanent top 10 player now and Ruby
seems to become one soon. Some languages that were supposed to break through in
2019 didn’t: Rust won only 3 positions (from #33 to #30), Kotlin lost 3 positions (from
#31 to #35), Julia lost even 10 positions (from #37 to #47) and TypeScript won just one
position (from #49 to #48). Let’s see what 2020 has in store for us!
◦ *C won in 2017, too
O
SU
C
SE
2
42
1
J.E.Jones
Jan 2021 Jan 2020 Change
Programming
Language Ratings Change
1 2 C 17.38% +1.61%
2 1 Java 11.96% -4.93%
3 3 Python 11.72% +2.01%
4 4 C++ 7.56% +1.99%
5 5 C# 3.95% -1.40%
6 6 Visual Basic 3.84% -1.44%
7 7 JavaScript 2.20% -0.25%
Python won this past year, but C is still very popular.
O
SU
C
SE
2
42
1
J.E.Jones
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//
O
SU
C
SE
2
42
1
J.E.Jones
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;
Still a highly popular language. Make yourself more marketable.
O
SU
C
SE
2
42
1
J.E.Jones
“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 you are being asked to
provide.
“Low Level” languages (assembler) provide nothing but access to the
machines basic instruction set.
O
SU
C
SE
2
42
1
J.E.Jones
3/7/2016 blog https://www.pluralsight.com/blog/software-
development/why-every-programmer-should-learn-c
“Before we begin, let me defend the somewhat outrageous title of this article with an analogy: You can
make your own bread with a prepackaged mix, a bread machine and some electricity—or, you can
assemble the raw ingredients, a mixing bowl, a stout spoon, a dough blade, fire up the oven and get
some cardio through kneading. If it’s just fresh bread you’re after, the machine gets you there.
But if you want to understand the underlying process and have the most options when it comes to the
final product, you need to put in the effort of the manual method. This is a lot like tackling the C
programming language: You have to dig down into the flour and get your hands dusty, but you end up
understanding the process at an intimate level.”
You should read the entire blog post…
O
SU
C
SE
2
42
1
J.E.Jones
6/19/2019 Infoworld Article:
https://www.infoWorld.com/article/3402023/why-the-c-programming-
language-still-rules.html
“No technology sticks around for 50 years unless it does its job better than most anything else—
especially a computer technology. The C programming language has been alive and kicking since
1972, and it still reigns as one of the fundamental building blocks of our software-defined world.”
This article compares C with other current programming languages, it’s
not always a positive commentary on C, but still well worth the time to
read.
O
SU
C
SE
2
42
1
J.E.Jones
Have you created an email account that you can use to “register” on websites
that isn’t your day-to-day email account?
◦ That you can use as a valid email account – because it is
◦ That you can check out from time to time if you want
◦ That keeps a lot of spam out of your day-to-day account
Have you created an email account that you only use for job searches? That
has a “professional” look?
◦ doesn’t cut it as a professional email address
Or do you plan to use your OSU account forever?
Just a thought…
O
SU
C
SE
2
42
1
J.E.Jones
Add these to your resume now:
◦ C programming language
◦ Experience with the gdb debugger with C and x86-64 assembly
◦ x86-64 assembly language
◦ Perform an audit of your other classes to determine if there are other items that should be added
We may also be using the gef add-on to gdb. Several students have come back from
internships raving about how much it helped them. I’m trying learn enough about it,
that I can incorporate it into this class this semester.
You should audit/add again before Autumn ‘21
It’s a lot of work, but until 1) you have decided that you don’t ever want/need another
position and, 2) if you are let go by your current employer, you will retire, your
resume should never be more than 6 months out-of-date. Just sayin’….
O
SU
C
SE
2
42
1
J.E.Jones
Sometimes students want me to write a letter of recommendation for them for grad school or
some other purpose (e.g., Mortar Board, internships, etc.) later in their academic career.
If you think you might want me to do that for you, please let me know prior to the end of
this semester. This allows me to put together a more complete letter while your stellar
performance is in my short-term memory. Then 18 months from now, I’ll be able to write a
compelling letter for you.
I will not write a letter of recommendation for anyone who has not completed this course
(i.e., I won’t write a letter of recommendation for you during THIS semester.)
Include a photo of yourself (head/shoulders) so that I can connect a name to a face.
You must waive your rights to see the recommendation. This is typically standard practice.
The acceptance committees that read the recommendations look for this to ensure that the
recommendations are more truthful.
O
SU
C
SE
2
42
1
J.E.Jones
Going from Java to C is like going from an automatic transmission to a
stick shift
Lower Level: much more is left for you to do (usually, more efficiently)
Unsafe: you can set your computer on fire (hopefully, just figuratively)
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
O
SU
C
SE
2
42
1
J.E.Jones
Java is to “paint by numbers”
as
C is to “oil paint on canvas”
(They may be right. You can tell me what you think at the end of the semester.)
O
SU
C
SE
2
42
1
J.E.Jones
A person with a more sophisticated view of technology (I hope that describes all
of you ) would not ask this question, but rather, a different one:
◦ 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 each situation. This course will, hopefully, give you information to
help make this type of decision.
O
SU
C
SE
2
42
1
J.E.Jones
Cell phones
desktop computers
Web servers
Application servers
Rapid development
O
SU
C
SE
2
42
1
J.E.Jones
They do exactly what you tell them to do
No built-in memory management (memory leaks, OH MY!)
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 him/her rather than what you meant.
No frills, no overhead, just raw power/speed
This is what makes it challenging
And this is what makes it fun!
O
SU
C
SE
2
42
1
J.E.Jones
Performance Critical Applications
◦ games*
◦ 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
Just about anything where raw power and speed are required
* Google says games, but I asked a friend in the gaming industry what languages are used today, and he responded:
“In terms of pure languages, C++ is still the high runner. The Unity framework is worth looking into- lots of games
are made on top of Unity. For Apple, things differ because they have total control of the App Store”, He didn’t tell me
how they differ. (12/21/2017)
O
SU
C
SE
2
42
1
J.E.Jones
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.
O
SU
C
SE
2
42
1
J.E.Jones
Purpose: to get acclimated to the stdlinux environment, PulseVPN, FastX, process for submitting
labs, and (potentially) your first work with a debugger
Budget 90 minutes of uninterrupted time to complete this lab, many will need far less, but there is
some reading to do.
Detailed description of the assignment and needful files are posted on Piazza.
Two Due Dates: Early (10% bonus)/Real/Late 24 hours or less (max 75% credit)
◦ This will be a feature for *each* and every lab you have
Generally, you should read and follow the instructions for the labs carefully. There will be a
CONSTRAINTS section in each lab (after lab 1); READ THIS SECTION prior to coding your
lab and READ IT AGAIN right before you submit your lab.
People sometimes make avoidable mistakes, and lose all the credit, or significant numbers of points
because the directions for the lab (in all sections) are not followed. Following instructions is
important when you have a job – and a customer, and it’s important here, too. The graders and I
are your customer for this class. We will not grant you relief from errors you make because
you did not read, or did not follow, the instructions. Many of these type errors will results in a
grade of 0 points.
O
SU
C
SE
2
42
1
J.E.Jones
Use xterm as your vehicle to work on stdlinux. Part of this course
is learning how to maneuver around linux/Unix in a BASH shell.
If you choose to use MATE, then you won’t be able to answer the
BASH shell questions on the midterm.
Don’t start working on a lab the day it is due. It has not worked
out well for any of my students in the past. You may be the
exception, but, maybe, not.
Get comfortable with the man command and how to read the
manual pages it brings up.
O
SU
C
SE
2
42
1
J.E.Jones
No code to write
Some (short) articles to read
Some navigation within a Linux command line
window (BASH shell)
Compiling C programs
Some experience using the gdb debugger
How to zip files (many may already know)
How to submit to Carmen from stdlinux
You can rush through this lab and learn nothing
from it, or you can think about what you are doing
and make the rest of the semester easier for yourself.
Your choice.
O
SU
C
SE
2
42
1
J.E.Jones
By convention, C source code files in a Unix/Linux
environment have a .c “extension” (It isn’t really an
extension in Unix/Linux, and the OS does not need
it; the source code file is just a text file, and the OS
can identify it as a text file without the .c).
Unix/Linux files names cannot contain spaces unless
“acrobatics” are used to reference the file name
O
SU
C
SE
2
42
1
J.E.Jones
Documented in the Lab 1 Description document
Copy the file exactly as it is. This is not the time for
“poetic license”. Don’t use copy/paste. You will
likely get a few unprintable characters in your .c file
that will cause problems.
Part of the reason to type it in is to allow you to
really observe how the program was written. How it
is different from (similar to) other languages you
have used.
O
SU
C
SE
2
42
1
J.E.Jones
After you enter the complete source code as
specified in the Lab 1 description document, save
the file from within the text editor.
You can leave the text editor open and enter
commands on the Linux command line (if you used
‘&’ when you opened the text editor).
After saving, you can compile the source code as
specified in the Lab 1 description
Although using the supplied Makefile is easier:
% make
O
SU
C
SE
2
42
1
J.E.Jones
The gcc compiler collection can be used to compile, or more technically,
build, C source code under a number of different standards, including
ANSI C (sometimes called C89), C90, or C99
In this class, we will learn ANSI C, or C89, which is actually the same
standard as C90 (but the two were published separately, and that’s why
there are two distinct names, even though there is only a single standard).
When you build/compile code for any C language lab in this class, you
must build it with the -ansi -pedantic options, so that you will get
warnings about code that does not comply with the C89/C90 standard (the
-pedantic option does this).
The graders will build your code this way. ANY lab code that, when
compiled as above, generates any errors or warnings, even if it builds
successfully (that is, even if there are no syntax errors which prevent
compilation) will receive NO POINTS. NO EXCEPTIONS.
The –g option is used when we plan to use the executable with the
debugger, gdb (in our example).
O
SU
C
SE
2
42
1
J.E.Jones
A large percentage of industry environments still use
ANSI C (C89/C90), so it’s important to learn this
standard, and that’s why we use it in this course.
This is a mandate from the CSE 2421 Course
Coordinator.
For this reason, in terms of portability, writing
ANSI-compliant C code is important also.
(Employers like this.)
Learning the differences later between ANSI C and
another standard, say C99, is not difficult if you
need to do it later.
O
SU
C
SE
2
42
1
J.E.Jones
Learning how to use the debugging program, gdb, will make
your life in this class significantly easier. As well, make you
more marketable.
◦ Some interviewers use experience with a debugging program as a
gate to second interviews
Using print statements helps some, but not as much as using
gdb.
gdb allows you to:
◦ watch your program run instruction by instruction
◦ observe a variable change values and see when things you thought
would happen don’t
◦ Give you opportunities to fix them within your code with
significantly less effort than staring at your code into the wee hours
of the morning.
Reference Bryant & O’Hallaron Figure 3.39 for sample gdb
commands
O
SU
C
SE
2
42
1
J.E.Jones
Learning how to use the debugging program, gdb, will make
your life in this class significantly easier. As well, make you
more marketable.
◦ Some interviewers use experience with a debugging program as a gate
to second interviews
Using print statements helps some, but not as much as using
gdb.
gdb allows you to:
◦ watch your program run instruction by instruction
◦ observe a variable change values and see when things you thought
would happen don’t
◦ Give you opportunities to fix them within your code with significantly
less effort than staring at your code into the wee hours of the morning.
Reference Bryant & O’Hallaron Figure 3.39 for sample gdb
commands
This reference will help you A LOT!!
O
SU
C
SE
2
42
1
J.E.Jones
gdb(1) GNU Tools gdb(1)
NAME
gdb – The GNU Debugger
SYNOPSIS
gdb [-help] [-nx] [-q] [-batch] [-cd=dir] [-f] [-b bps] [-tty=dev] [-s symfile] [-e prog] [-se prog] [-c core] [-x cmds] [-d dir]
[prog[core|procID]]
DESCRIPTION
The purpose of a debugger such as GDB is to allow you to see what is going on ‘‘inside’’ another program while it
executes—or what another program was doing at the moment it
crashed.
GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:
ꞏ Start your program, specifying anything that might affect its behavior.
ꞏ Make your program stop on specified conditions.
ꞏ Examine what has happened, when your program has stopped.
ꞏ Change things in your program, so you can experiment with correcting the effects of one bug and go on to learn about
another.
Check out Figure 3.39 in Computer Systems: A Programmer’s Perspective, 3rd Edition (page 280)
O
SU
C
SE
2
42
1
J.E.Jones
ddd(1) GNU Tools ddd(1)
NAME
ddd – The Data Display Debugger
SYNOPSIS
ddd [–help] [–gdb] [–dbx] [–ladebug] [–wdb] [–xdb] [–jdb] [–pydb] [–perl]
[–debugger name] [–[r]host [[username@]hostname]] [–trace] [–version] [–config-
uration] [options…] [prog[core|procID]]
but usually just
ddd program
DESCRIPTION
DDD is a graphical front-end for GDB and other command-line debuggers. Using DDD, you can
see what is going on “inside” another program while it executes—or what another program was
doing at the moment it crashed.
DDD can do four main kinds of things (plus other things in support of these) to help you
catch bugs in the act:
O
SU
C
SE
2
42
1
J.E.Jones
File: ddd.info, Node: Top, Next: Summary, Up: (dir)
Debugging with DDD
******************
DDD is a graphical front-end for GDB and other command-line debuggers.
This is the First Edition of `Debugging with DDD’, 8 Feb, 2009, for
DDD Version 3.3.12.
The first part of this master menu lists the major nodes in this Info
document, including the label and command indices. The rest of the menu
lists all the lower level nodes in the document.
* Menu:
* Summary:: Summary of DDD.
* Sample Session:: A sample DDD session.
* Invocation:: Getting in and out of DDD.
* Windows:: The DDD windows, menus, and buttons.
* Navigating:: Moving through the source code.
* Stopping:: Making your program stop at specific locations.
* Running:: Running programs under DDD.
O
SU
C
SE
2
42
1
J.E.Jones
http://www.gnu.org/software/ddd/manual/
The DDD manual is available in the following formats:
•formatted in HTML (633K characters, 3.5M pictures)
entirely on one web page.
•formatted as a PDF file (1.5M characters).
•formatted as a PostScript file (859K characters zipped).
A plain text version of the DDD manual is compiled within DDD;
it can be viewed
• from within DDD using `Help -> DDD Manual’ or
• by invoking DDD as `ddd –manual’.
Texinfo sources as well as Info files are included in the
DDD source distribution.
O
SU
C
SE
2
42
1
J.E.Jones
Execute gdb or ddd in the directory that contains all your source code files and your executable.
This might be $HOME/cse2421/lab1
Everyone knows that debugging is twice as hard as writing a program in the first place. So if you’re
as clever as you can be when you write it, how will you ever debug it? – Brian Kernighan, “The Elements of
Programming Style”, 2nd edition, chapter 2
The most effective debugging tool is still careful thought, coupled with judiciously placed print
statements. – Brian Kernighan, “Unix for Beginners” (1979)
(Unfortunately, print statements can change the timing of programs, thus hiding
the bug you are trying to find. This is especially true when trying to debug networking
or operating system code. As well, sometimes print statements don’t finish executing
before your program abnormally exits.– Janis Jones)
O
SU
C
SE
2
42
1
J.E.Jones
Once you can compile and run the program successfully and
have performed the debugger commands specified, you can
submit it.
Programs must be submitted to Carmen in a .zip file.
The instructions for creating a .zip file are included in the lab1
description document and in your Makefile
The graders will pull the labs from Carmen and test them on
stdlinux based on the grading criteria.
O
SU
C
SE
2
42
1
J.E.Jones
Did you submit ALL necessary files so that your
program compiles? If no, then 0 points awarded.
Were there any errors or warnings when compiled?
If yes, then 0 points awarded.
Does the program execute correctly with the example
input provided? What about other valid input?
Does the program execute correctly when
“boundary” conditions are encountered?
Were the constraints from the lab description adhered
to?
Did you follow all other lab description instructions?
O
SU
C
SE
2
42
1
J.E.Jones
If you use it, this shell file will help you ensure that you
are submitting a .zip file that will compile for the
graders.
Once you create the file in your directory, you will have
to change its properties so that it will execute with the
following shell command: chmod +x verify
echo “files in lab directory”
ls
mkdir test
unzip lab1.zip –d test
make –C test lab1
echo “files in test directory”
ls test
rm -rf test
In each lab, you will have to change the name of the zip
file and the make instruction target
O
SU
C
SE
2
42
1
J.E.Jones
Take a look at the other Linux commands that are
shown in the document called
LabUnixCommands.pdf on Piazza.
The commands in the pdf should be all that you’ll
need for this course.
Nonetheless, if you need to know how to do
something that you haven’t done before, you can do
an internet search to find the relevant commands.
There may even be a quiz on the commands