1 / 32

Workshop: C Programming under the UNIX Operating System

Workshop: C Programming under the UNIX Operating System. Ran Eshel. Lecture Overview. Course overview and administration – requirements, syllabus, books and tools About UNIX, Linux and Open Source About C. Course Overview. In this course we forget about: OOP

Download Presentation

Workshop: C Programming under the UNIX Operating System

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. Workshop:C Programming under theUNIX Operating System Ran Eshel

  2. Lecture Overview • Course overview and administration – requirements, syllabus, books and tools • About UNIX, Linux and Open Source • About C

  3. Course Overview • In this course we forget about: • OOP • GUI (Graphical User Interface) • Instead, we go back to: • Procedural programming • CUI (Character User Interface), also known as command-line interface

  4. Course Requirements • Exercises • Approximately 8 programming exercises • Submission of all exercises is compulsory,missing exercises count as 0 in the average • First exercises submitted in pairs, others TBD • Grades of different exercises may be weighted based on their size and difficulty

  5. Course Requirements • Exam • With open material • Mostly programming (C and C Shell),some background knowledge • Grading policy • Final Grade = 80% exam + 20% exercises • Important: in order to pass the course you must pass each component separately

  6. Syllabus • Introduction to the UNIX environment • UNIX tools • Text processing • Pipes • Text editing with vi • UNIX Shell programming

  7. Syllabus • The C programming language • Types, operators and expressions • Control flow • Functions • Pointers and Arrays • Structures

  8. Course Books • A Book on C: Programming in C (4th Edition)–Al Kelley, Ira Pohl • In Amazon • In IDC Library • The C Programming Language (2nd Edition) – Brian Kernighan, Dennis Ritchie • In Amazon • In IDC Library

  9. Course Books • A Practical Guide to the UNIX System(3rd Edition) – Mark G. Sobbel • In Amazon • In IDC Library • A Practical Guide to the Linux Commands, Editors, and Shell Programming • In Amazon • In IDC Library

  10. Course Tools • All of the exercises in the course should be written on the IDC Linux server • The server can be accessed from anywhere using a remote client such as PuTTY • Files can be copied to and from the server using a secure FTP client (such as WinSCP) • Resources: SSH clients for MS-Windows

  11. Local Linux Installation • It is also possible (but not required)to install Linux on your home PC • There are many Linux variants. Recommended: Fedora, Ubuntu • Each can be used in two ways • Full install – not simple, and somewhat risky • Live media – good as a demo, but has many disadvantages for real work

  12. Lecture Overview • Course overview and administration – requirements, syllabus, books and tools • About UNIX, Linux and Open Source • About C

  13. Why Study UNIX? • For the past two decades, the computing world has been divided between: • The UNIX family (including Linux) • Microsoft Windows • Although recent years have seen a decline in UNIX installations, the growth of Linux compensates for this, and more

  14. Why Study UNIX? • During most of your studies you concentrate on Windows • This course will complete your operating system education with UNIX • An additional benefit: every programmer must have at least some experience with command-line and with shell scripting

  15. UNIX Advantages • Stability • Processes are isolated • Crashes are rare, and locally contained • Flexibility • Modular structure, small and simple elements • Source code is usually available (Linux) • Real multi-user support

  16. UNIX • Portability • Some UNIX variant is available for almost every existing platform • The first major operating system to be written in a high level language • Text – A Simple Interface • Use of text streams as program interfaces • Use of text files to store data

  17. A Brief History of UNIX • Mid 60's – Multics, a large multi-user operating system project (AT&T, GE, MIT) • 1969 – Multics project is behind schedule, Ken Thompson starts working on UNIX • A smaller version (Multics does many things;UNIX does one thing well – run programs) • First UNIX version is operational before Multics • 1970 – UNIX officially named and running

  18. UNIX • "The number of UNIX installations has grown to 10, with more expected." The UNIX Programmer’s Manual, 1972 • "The number of UNIX variants has grown to dozens, with more expected." Rob Pike, Bell Labs, 2001

  19. The UNIX Family • During most of UNIX's long history, two major versions existed in parallel: • System V, a commercial version maintainedby AT&T Bell Labs (original creators of UNIX) • BSD (Berkley Software Distribution), created first with the cooperation of AT&T, but lateras a competing free alternative • Linux combines most features of both

  20. Branches of the UNIX Family

  21. The UNIX Philosophy • Write programs that do one thing,and do it well • Write programs to work together • Write programs to handle text streams, because that is a universal interface

  22. Linux • An Open Source version of UNIX • A complete operating system, including GUI, distributed freely over the internet • Not only executables are available, but also the complete source code • Distributed under the GNU General Public License

  23. Free Software (Open Source) • The GPL grants users with the freedom to: • Run the program for any purpose • Study how the program works, and modify it • Redistribute copies • Improve the program, and release the improvements to the public • The only requirement – derivative works must also be licensed under the GNU GPL

  24. Free Software (Open Source) • Free Software (also called Open Source),is not freeware – it can cost money • "Free software is free as in 'free speech',not as in 'free beer'" Richard Stallman, The Free Software Foundation • Surprisingly, open source projects are as fast and as reliable as commercial projects

  25. Lecture Overview • Course overview and administration – requirements, syllabus, books and tools • About UNIX, Linux and Open Source • About C

  26. Why Study C? • A small and simple language • Helps clarify basic computer concepts • Still the most efficient language • Does not have the overhead of Object Oriented languages • Still the most powerful language • If you can't do it in C, you just can't do it

  27. C and OOP • C is the basis for the most common Object Oriented languages – C++, Java and C# • C is perfect for procedural programming • Procedural programming is not the opposite of Object Oriented Programming – it is an essential part of it • OOP can be seen as an extension of procedural programming

  28. C and UNIX • C is the native language of UNIX, and the language in which UNIX itself is written • Together, C and UNIX revolutionized the computer world • The combination of a UNIX environment coupled with C programming is still common in many large companies

  29. A Brief History of C • The first version of UNIX was written in PDP-7 assembly language (like most operating systems of the time) • Ken Thompson wanted to rewrite it in some high-level language for two reasons: • Clarity – ease of modification • Portability to other machines

  30. A Brief History of C • The PDP-7 was notpowerful enough to hosta compiler for any existinghigh-level language • To overcome this problem,a new language was written Ken Thomson and Dennis Ritchie on the PDP-11

  31. A Brief History of C • The new language was a simplified version of BCPL, and was therefore called B • Later, B was enhanced by Dennis Ritchie,and the new language was called C • The most significant improvement – types • In 1973, UNIX was rewritten in C • Shortly afterwards it was ported to thePDP-11, and then to many other machines

  32. A Brief History of C • The performance of UNIX written in C was very similar to that of operating systems written in Assembly language • Since then, performance has become C's most prominent feature, making it the standard operating systems language

More Related