1 / 37

CSCI 243: C & UNIX

CSCI 243: C & UNIX. Kirk Anne South 124A kma@geneseo.edu. Course Description. 5 weeks Teach you how to use UNIX Teach you how to program in C Practical, not theoretical “Tricks of the trade” How to not spend hours in front of the computer. Grading.

adsila
Download Presentation

CSCI 243: C & UNIX

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSCI 243: C & UNIX Kirk Anne South 124A kma@geneseo.edu

  2. Course Description • 5 weeks • Teach you how to use UNIX • Teach you how to program in C • Practical, not theoretical • “Tricks of the trade” • How to not spend hours in front of the computer

  3. Grading • The only way to learn C is to program. • Programs will be graded on: • Correctness • Style • Spelling • Programs must produce correct answers. • If errors, programs should exit gracefully.

  4. Projects • Syllabus tells you what you need for a “C”. • Three programs by end of week 2. • Three programs by end of week 3. • Three programs by end of week 4. • One program and final project, end of week 5. • Final project • Can be from another class to save time

  5. A 250+ A- 225 B+ 200 B 175 B- 150 C+ 125 C 100 C- 75 D 50 E 25 Points

  6. Final Project • You can use a project from another class • Or… • Write a library of functions for a stack and a “reverse Polish notation” calculator (HP) • Write a “substantial program”

  7. Week 1: Intro Week 2: Basic C Week 3: Structures Week 4: Pointers Week 5: Shell Scripts Editors, X windows Control statements Functions Debugging, profiling Course Wrapup Tentative Schedule

  8. Plagiarism • The exercises are published on the Internet. • I know this. • This class may be your only chance to practice C with the “safety net”. • This is where you will learn how C works. • Cheating will only hurt you.

  9. The History (!!) of UNIX

  10. History of UNIX • 1969… • The Year of Woodstock • Armstrong walks on the moon • The Year of “Space Travel” • A PDP-7 sits in a corner of a lab… • 9K of RAM • Paper tape drive • Teletype 33 terminal

  11. A plan comes together... • Dennis Ritchie and Ken Thompson take a PDP-7 and use their research at AT&T to produce the first computer that can play “Space Travel”. • Based on research from GE, MIT and AT&T called Multics, a powerful operating system, UNIX is born. • But much simpler...

  12. Multics • Multiplexed Information & Computing Service • Too big to work but had… • Interactivity • Shared Physical and Virtual Memory • Symmetric Multiprocessing • Security • Software Engineering • Hierarchical File Storage System • Programmed in PL/I

  13. UNIX • Took a lot of Multics ideas • But reduced the complexity • Originally written in assembly • Uses a “layered” approach to achieve complexity

  14. What’s “C” got to do with it? • C is derived from BCPL, another language available on Multics. • C is a “middle level” language. • Low level - Assembly (fast but only one CPU) • High level - FORTRAN, PL/I (slow, but easy) • C allows you the power of assembly with the ease of a high level language.

  15. C makes UNIX portable • Kernighan & Ritchie write a C compiler to prepare code for the PDP-7 UNIX project. • Made C small and easy to port. • When they got a PDP-11 with 24K, it ported quickly. • After converting the UNIX system from assembly to C, it ported quickly too.

  16. UNIX becomes popular • Once a C compiler is written for a new CPU, the UNIX operating system can be ported soon after. • AT&T couldn’t sell UNIX because the gov’t said that their phone monopoly was enough. • They gave it away to universities...

  17. UNIX meets Berkeley... • CS graduate students got their hands on the source code for an entire operating system. • The prices for PDP-8s and PDP-11s enabled research universities to allow grad students to work on their “own”computers. • UC Berkeley graduates take the source and run...

  18. BSD UNIX • Bill Joy (one of the founders of Sun Microsystems), leads the CSRG to build a new version of UNIX called Berkeley Software Disitribution (BSD). • SUN actually stands for Stanford University Network.

  19. CSRG products • “vi” (vee-eye) • sendmail • lint • make • TCP/IP (Internet) • telnet, ftp, rlogin, rsh, rcp, etc…

  20. The “Tower of Babel” • AT&T invents UNIX • Berkeley reinvents UNIX as BSD UNIX • Corporations realize it’s cheaper to use UNIX • Everybody has a version of UNIX • Two major types • AT&T System V and BSD

  21. Corporate UNIX • In the early 1990’s, corporations wanted to have a “corporate UNIX” that conformed to standards. • The Open Software Foundation was formed to create a “standard UNIX”. • AT&T wanted to keep the UNIX name.

  22. What goes around, comes around • AT&T joined forces w/ Sun (Bill Joy,BSD) to create the UNIX Software Labs and System V Release 4 (SVR4). • Sun drops development on its BSD system • Solaris is born...

  23. UNIX Terms

  24. “Buzz Word” Compliant • Multiuser • more than one person can use the system • Multitasking • more than one job can be done at a time • Hierarchical • Different levels, resembling an upside-down tree

  25. File System

  26. CPU The “UNIX” Way... Shell Kernel

  27. Logging in...

  28. Logging into a UNIX system • Telnet to a system • X Windows (on the console) • “rlogin”

  29. Changing your password • “passwd”

  30. Getting out • “logout” • “exit” • Exit the Window System

  31. Basic UNIX commands Remember that PDP-7 with 9K of memory and 110 baud Teletype 33 terminal???

  32. date ls cat file mv old new cp original new rm file more file pwd See what time it is List directory Display a file Move a file (rename) Copy a file Remove a file Page through a file Print working directory Basic UNIX commands

  33. UNIX Files • One of the strengths of UNIX is that a “file” is just considered a stream of information with a starting point and an optional length. • UNIX can treat almost anything as a file. • Because of this, handling data is very easy.

  34. Directories • A directory is a special type of file that holds information about other files. • Can be used to store similar files • mkdir Make a directory • cd Change directory • rmdir Remove an empty directory • ls List a directory

  35. Wildcards and“Regular Expressions” • A star “*” indicates all files that match. • A question mark “?” means just one character. • Brackets can restrict which letters are used. • [A-Z] All upper case letters • *[02468] All files that end w/even numbers • [aeiou]* All files that start w/vowels

  36. Next time... • Man pages • Editors • X windows • File permissions • How to handle processes

  37. For more information... http://cbt.geneseo.edu/ (Check out the UNIX CBTs)

More Related