1 / 114

Introduction to Computer Systems

This course provides an introduction to computer systems, covering topics such as hardware, software, programming, and system design. The course includes hands-on labs and practical assignments to enhance learning.

ftoth
Download Presentation

Introduction to Computer Systems

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. Introduction to Computer Systems

  2. Outline • Teaching staffs • Textbook and Grading • Course Schedule • Motivation • Suggested reading • Preface xvii~xx

  3. Instructor • 路红 • Email: honglu@fudan.edu.cn • Office phone: 51355528 • 413-1, Computer Building • Make Appointment or Open Door Policy

  4. Teaching Assistants • 蒋国宝,陆进 • 蒋国宝:11210240049@fudan.edu.cn;13917854916(314-计算机楼) • 陆进:11210240054@fudan.edu.cn; 18721708786(314-计算机楼)

  5. Teaching Notes • 10.141.247.12 • User: ics2012 • Pwd: ics2012 • \ • Right: can read/write and cannot delete

  6. Text Book • Randy Bryant and David O’Hallaron, • Computer Systems: A Programmer’s Perspective • Prentice Hall, August 12, 2002. • 电子工业出版社,2006. • Brian Kernighan and Dennis Ritchie, • The C Programming Language, Second Edition • Prentice Hall, 1988

  7. Grading • Exams(70%) • Mid-term exam (20% ) • Final exam (50%) • All exams are open books/open notes; in Englishg • Labs (24%) • 4~5 labs, (4-10% each) • Home work + 点名 (6-10%)

  8. Grading • Lab deadline & Late Submission • Due at 11:59pm of the specific due date • Give 5 late days • Lose 1/5 of points for each other late day

  9. Course Schedule -1 • Mainly introduce the content of Chap 1 ~ Chap 6. Some content in Chap 10. And some content in Chap 7, Chap 8, if time permitted.

  10. Course Schedule -2 • 2012 ICS课程PPT安排表.doc

  11. Course Schedule -3 • Every Thursday afternnon --- Teaching • Every Monday morning, • Odd Week, Exercise Q/A • Even Week, LAB

  12. Why are we here? • From abstractions to details (realities) • From application level to system level • From Java to C

  13. Features of this course • Enduring Concepts • From programmer’s perspective • Actively study • Becoming the rare “power programmer” Enduring: 持久的

  14. Enduring concepts • Computer systems consists hardware and systems software that work together to run programs • Specific implementations of systems change over time • But the underlying concepts do not • All computer systems have similar hardware and software components that perform similar functions

  15. From programmer’s perspective • Written for programmers instead of system builders • Few students would have the opportunity to build a computer system • Even the computer engineers would be required to use and program computers on a daily basis • It covers a topic only if it affected • correctness, performance or utility of user-level C programs

  16. From programmer’s perspective • Topics on hardware adder and bus designs were out • Introduce assembly in a different way • How C constructs are translated by the compiler • Pointers • Loops • Procedure calls and returns • Switch statements

  17. From programmer’s perspective • Take a broader and more realistic view of the system • Linking and loading • Process, signals • Performance optimization • I/O and network and concurrent programming (Not introduced here, can read if you are interested in.)

  18. Actively study • New concepts are followed by practical problems • Homework problems and labs are also real • Learning by doing • Working concrete problems • Writing and running programs on real systems • Practical, concrete, hands-on and exciting

  19. Becoming the rare “power programmer” • Enlightened by an understanding of • the underlying computer system • and its impact on your application programs • You know • How things work and • How to fix them when they break

  20. Examples that we are going to learn • How to avoid strange numerical errors • caused by the way that computers represent numbers • How to optimize the C code by using • Clever tricks that exploit the designs of modern processors and memory systems

  21. Examples that we are going to learn • How the compiler implements procedure call • How to use above knowledge to avoid • The security holes from buffer overflow bugs that • Plague network and Internet software • How to recognize and avoid the nasty errors during linking • That confound the average programmer Plague: 引起麻烦 Nasty: 危险的 Confound: 混淆

  22. Examples that we are going to learn • How to write our own (*Optional) • Unix shell • Dynamic storage allocation • Web server

  23. Fundamental course for systems • Compilers • Operating Systems • Networking • Architectures (with digital component design)

  24. Platforms • Hardware platform • Intel IA-32 • Operating system • Linux • Programming language • ANSI C • Compiler • GNU-gcc

  25. The C Programming Language • C was developed • in 1969 to 1973 • by Dennis Ritchie of Bell Laboratories. • The American National Standards Institute (ANSI) • ratified the ANSI C standard in 1989. • The standard defines • the C language • and a set of library functions known as the C standard library. Ratify: 批准,认可

  26. The C Programming Language • Kernighan and Ritchie describe ANSI C in their classic book • which is known affectionately as “K&R” . • In Ritchie’s words [60], C is • quirky, • flawed, • and an enormous success. • Why the success? Quirky: 离奇的 Flawed: 有缺陷的

  27. The C Programming Language • C was closely tied with the Unix operating system. • C was developed from the beginning as the system programming language for Unix. • Most of the Unix kernel, and all of its supporting tools and libraries, were written in C. • As Unix became popular in universities in the late 1970s and early 1980s, many people were exposed to C and found that they liked it. • Since Unix was written almost entirely in C, it could be easily ported to new machines, which created an even wider audience for both C and Unix.

  28. The C Programming Language • C is a small, simple language. • The design was controlled by a single person, rather than a committee, and the result was a clean, consistent design with little baggage. • The K&R book describes the complete language and standard library, with numerous examples and exercises, in only 261 pages. • The simplicity of C made it relatively easy to learn and to port to different computers.

  29. The C Programming Language • C was designed for a practical purpose. • C was designed to implement the Unix operating system. • Later, other people found that they could write the programs they wanted, without the language getting in the way.

  30. The C Programming Language • C is the language of choice for system-level programming • There is a huge installed based of application-level programs as well.

  31. The C Programming Language • However, it is not perfect for all programmers and all situations • C pointers are a common source of confusion and programming errors • C also lacks explicit support for useful abstractions such as classes and objects • Newer languages such as C++ and Java address these issues for application-level programs

  32. How do we start • From a very simple program “Hello” • To run and completion this simple program • Every major part of the system must work in concert • This course is to help you understand • what happens and why • When you run hello on your system

  33. “Hello world” example 1 #include <stdio.h> 2 3 int main() 4 { 5 printf("hello, world\n"); 6 }

  34. How do we start • We begin our study of systems by • Tracing the lifetime of the hello program • From it is created by a programmer • To it runs on a system, prints its result, and terminates

  35. Outline • Bit and Byte • Context is very important • Understand machine representations of numbers • Information storage • Bit level manipulation • Suggested reading • Chap 1.1, 2.1

  36. “Hello world” example 1 #include <stdio.h> 2 3 int main() 4 { 5 printf("hello, world\n"); 6 } • Source program • Created by editor and saved as a text file

  37. “Hello world” example # i n c l u d e <sp> < s t d i o . 35 105 110 99 108 117 100 101 32 60 115 116 100 105 111 46 h > \n \n i n t <sp> m a i n ( ) \n { 104 62 10 10 105 110 116 32 109 97 105 110 40 41 10 123 \n <sp> <sp> <sp> <sp> p r i n t f ( " h e 10 32 32 32 32 112 114 105 110 116 102 40 34 104 101 l l o , <sp> w o r l d \ n " ) ; \n } 108 108 111 44 32 119 111 114 108 100 92 110 34 41 59 10 125

  38. Why Bit? • The source program is a sequence of bits • Modern computers store and process • Information represented as two-valued signals • These lowly binary digits are bits • Bits form the basis of the digital revolution

  39. The Decimal Representation • Base-10 • Has been in use for over 1000 years • Developed in India • Improved by Arab mathematicians in the 12th century • Brought to the West in the 13th century by • the Italian mathematician Leonardo Pisano, • better known as Fibonacci. * Fibonacci:斐波纳契数列(一种整数数列, 其中每数等于前面两数之和)

  40. Why Bit? • Using decimal notation is natural for ten-fingered humans • But binary values work better when building machines • that store and process information

  41. Why Bit? • Two-valued signals can readily be • represented, stored, and transmitted, • Examples • The presence or absence of a hole in a punched card • A high or low voltage on a wire • A magnetic domain oriented clockwise or counterclockwise.

  42. Why Bit? • The electronic circuitry is very simple and reliable for • storing and performing computations on two-valued signals • This enabling manufacturers to integrate • millions of such circuits on a single silicon chip

  43. Group Bits • In isolation, a single bit is not very useful • However, we are able to represent the elements of any finite set by using bits • To do this, we • first group bits together • then apply some interpretation to the different possible bit patterns • that gives meaning to each patterns Interpretation: 解释

  44. ASCII standard • 8-bit chunks are organized as a byte • Each byte represents some text character in the program • Most modern systems represent text characters • using the ASCII standard • ASCII standard represents • each character with a unique byte-sized integer value

  45. “Hello world” example # i n c l u d e <sp> < s t d i o . 35 105 110 99 108 117 100 101 32 60 115 116 100 105 111 46 h > \n \n i n t <sp> m a i n ( ) \n { 104 62 10 10 105 110 116 32 109 97 105 110 40 41 10 123 \n <sp> <sp> <sp> <sp> p r i n t f ( " h e 10 32 32 32 32 112 114 105 110 116 102 40 34 104 101 l l o , <sp> w o r l d \ n " ) ; \n } 108 108 111 44 32 119 111 114 108 100 92 110 34 41 59 10 125

  46. Text file • Source program is stored in a file • As a sequence of bytes • Each byte has an integer value that corresponds to some character • Text files • Files that consist exclusively of ASCII characters • Binary files • Files other than text files

  47. Information is Bits+Context • All information in a system is represented • as a bunch of bits • Such as • Disk files • Programs stored in memory • User data stored in memory • Data transferred across a network

  48. Information is Bits+Context • The only thing that distinguishes different data objects is • the context in which we view them • In different contexts, the same sequence of bytes might represent • A number (integer or floating point number) • A character string • A machine instruction • Context is very important in interpreting bits!

  49. Three number encodings • Unsigned encoding • Representing numbers greater than or equal to 0 • Using traditional binary representation • Two’s-complement encoding • Most common way to represent either positive or negative numbers • Floating point encoding • Base-two version of scientific notation for representing real numbers

  50. Understanding numbers • Machine representation of numbers are not same as • Integers and real numbers • They are finite approximations to integers and real numbers • Sometimes, they can behave in unexpected way

More Related