CSC209 Software Tools and Systems Programming https://mcs.utm.utoronto.ca/~209
What is this Course About? Software Tools Using them Building them Systems Programming Quirks of C The file system System calls Processes Communication
Marking Scheme Type of Work Probable Topics Weight Due date Lecture Preparation 5% 10:00 pm on Sundays Lab Exercises 10% 10:00 pm on Fridays Assignment 1 Basic C 5% Monday, Jan 29 @ 10:00 pm Assignment 2 C (Strings, Memory, Pointers) 10% Wednesday, Feb 14, 10:00 pm Midterm Shell and C 10% Monday, Mar 5, 5:00 pm Assignment 3 Processes 10% Mon, Mar 12, 10:00 pm Assignment 4 Communication 10% Monday, Apr 2, 10:00 pm Final Exam 40% TBD, 40% required to pass the course
In a Typical Week Prep (Online) Practice (Lecture) Perform (Labs and Assignments)
Prep / Labs on PCRS Almost all of the prep work and some of the lab work is hosted online, on PCRS: https://pcrs.teach.cs.toronto.edu/utm209 Students are added to the system twice a day (at around 1:30). If you can t log in more than 24 hours after you add the course, please let us know.
Missed the first PCRS? The first prepare was originally due last night, at 10. If you joined the class late (or if you just missed our emails), complete it ASAP. We ve extended the deadline to the end of the add period, to accommodate students who are joining the class late.
About Assignments
Submission Submission will be performed via git You will receive a git repository to use for this course. We will place starter code into that repository and will extract your submissions from the repository. Much of what we do with your repository will be automated. So Please be very careful with required filenames, directory structures, and output format Make sure that your code compiles without warnings or errors and can be run without crashing on a lab machine
This is important, so we ll repeat it in red If your submission does not compile or crashes when run, it will receive a 0. Please be sure to check your code on a lab machine before submitting it!
Resubmission To encourage you to look at the test output and to fix errors, we re offering resubmissions. We ll send you some test results within a day of submission. You may resubmit (correcting errors) or submit late up to 48 hours after the original deadline.
Resubmission Notes We ll mark the original submission (with no deduction) and the resubmission (with a 10% deduction) and take the higher score. The test results sent to you within a day or submission are test results, not marks. Some tests will be worth more than others. Some tests are included simply to point out an issue: they will be worth no marks. Just do your best to fix the errors we ve identified
Academic Integrity The work you submit must be your own, done without participation by others. It is an academic offence to hand in anything written by someone else without acknowledgement. You are not helping your friend when you give them a copy of your assignment. You are hurting your friend when you ask them to give you a copy of their assignment.
In Particular Do not Look at another student s assignment Discuss the design or implementation of assignments Include code from anywhere without attribution Get someone else to write your code You may Discuss ideas and topics from lecture or lab Help each other understand man pages or example code Help each other understand error messages
Preparing for 209
Linux This course assumes familiarity with linux. Get used to using a text editor on linux. Become familiar with the basic commands that will allow you to use the shell. You can ssh into the lab machines to work remotely. You may also wish to install your own linux virtual machine.
C This isn t really a programming course. We will use C, and we will cover key topics. However, we assume you have learned a few languages already (Python, Java, ) You may need to pick up some material on your own (conditionals, basic control flow, )
Coming Up This week: shell programming and compiling C Next week: Arrays and Pointers Prep is due on Sunday (well, Wednesday), on PCRS Labs are running as normal and are due on Friday Assignment 1 will be posted next week
Okay, let s take a quick break and then start as if we were beginning class
Coming Up This week: shell programming and compiling C Next week: Arrays and Pointers Prep is due on Sunday (well, Wednesday), on PCRS Labs are running as normal and are due on Friday Assignment 1 will be posted next week
Anonymous Seems a bit odd that our first PCRs has a ton of bash guides for the bash multiple choice questions which is fine, but no guides or tutorials whatsoever for the C coding questions, making it very difficult Below the Week 1 Preparation Quest, there s a C Basics Quest with videos and exercises. You may want to watch a few videos in there for next week s Preparation Quest, as well.
Anonymous I really didn t understand a single thing in the introductory PCRS assignment I just completed. It felt like I was supposed to have some prior knowledge that I definitely did not have. The command line might be quite new to you, if you haven t been using the linux labs in 108/148/207. If that s the case, then yes, you re missing something we re expecting. The labs this week and next should help, but you may need to put in some extra time to get up to speed. Please drop by office hours if you re stuck after lab!
Anonymous PCRS is extremely boring and never teaches me anything well. Please change it. It s such an extremely outdated and lazy way of teaching complex topics. Also, the readings are ridiculously hard to follow. I m sorry you re finding it boring. However, we ve seen success with this format in 209 downtown, where it has been used longer. CSC369 used to run an assignment 0 to get people up to speed on C, and we ve found we no longer need it. Performance on a quiz about pointers at the end of 209 has improved since we started using an inverted course with videos. The course (and PCRS) can certainly be improved, but based on the evidence we have, the inverted course is an improvement. I d love to talk to you in person about what you d prefer, if you re comfortable doing so.
Questions before we start?
The Unix Philosophy Write programs that do one thing and do it well. Write programs to work together. Write programs that handle text streams, because that is a universal interface.
Unix, Linux, Unix-like Unix is a propriety operating system developed by AT&T in 1969. Almost immediately, there were spin-offs. Minix Solaris Linux OS X I ll use the word unix to refer to a lot of operating systems that aren t actually Unix. You ll generally end up using a flavour of linux in this course.
Unix Principles Do one basic thing well Support simple input formats Plain text Don t require interactive input Provide output in a simple format Expect that it will be input to another tool (piping)
Unix Tools Examples ls cat sort grep standard input / standard output pipes
How Do You Learn Linux? Use it. Linux has a manual Don t memorize what you need to do Be task oriented and look up the things you need, as you need them: man < topic...> Common tasks will become familiar very quickly
Shells $ gcc o hello hello.c The $ above is a prompt, asking for user input. Shells accept commands (programs) as input find the executable interpret the arguments start executing the command Shells also have some built-in commands.
Running a program $ gcc o hello hello.c $./hello This loads a program into memory and hands it off to the OS to run the program.
A Program in Memory Memory is divided into segments. The program itself is loaded into the bottom segments: Read/write data Read only code and data
Paths $ gcc o hello hello.c $./hello Why did I need a./ in front of hello? Why was there nothing in front of gcc?
File System Hierarchy / res nfs usr peters43 res stud bin lib local chatur18 www bin lib Use df to see all the different disk partitions on a linux machine.
File System Hierarchy Everything starts in the root directory whose name is / A directory is a file that contains directory entries. A directory entry maps a file name to an inode. An inode is the data structure that contains information about a file, including which disk blocks contain the file data. you ll learn way more about inodes than you ll want to in CSC369.
Files and Directories Everything is a file. Unix provides a file interface for all Input/Output. regular files directories devices video (block) keyboard (character) sound (audio) network (block) Try ls l /dev and look at the permissions string. crw------- brw------- c = character, b = block File interface = open, read, write, close
Directories and Links directory file 2. 2.. 14 u 46505 home 139412 cdrom 201345 lib % ls l / drwxr-xr-x 2 root root 4096 Nov 8 17:56 bin/ drwxr-xr-x 2 root root 4096 Aug 10 14:46 cdrom/ drwxrwsr-x 2 root staff 4096 Feb 8 2002 home/ drwxr-xr-x 6 root root 4096 Sep 2 15:26 lib/ lrwx------ 1 root root 6 Sep 2 15:32 u -> /mcs/u/
-rwxr-xr-x Permissions File permissions read, write, execute pretty much what you think Directory permissions read you can run ls on the directory write you can create and delete files in the directory execute you can pass through the directory when searching subdirectories.
-rwxr-xr-x chmod chmod 755 <filename> 3 numbers between 0 and 7, the octal value for that category of user Quiz what is the command to set the permissions of the file classlist to be world readable but writeable only by the file owner and members of the group. Another approach chmod u+rwx chmod go-x adds or removes permissions for those categories of users
Helpful Trick: Globbing A little like regular expressions but different syntax * matches any number of any character? matches any one character [list of characters] [1-5] or [a-z] or [a-xz]