22.02.2014 Views

SYSTEMS PROGRAMMING (37-023) Programming in Assembler ...

SYSTEMS PROGRAMMING (37-023) Programming in Assembler ...

SYSTEMS PROGRAMMING (37-023) Programming in Assembler ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Eidgenössische<br />

Technische Hochschule<br />

Zürich<br />

<strong>SYSTEMS</strong> <strong>PROGRAMMING</strong><br />

(<strong>37</strong>-<strong>023</strong>)<br />

<strong>Programm<strong>in</strong>g</strong> <strong>in</strong> <strong>Assembler</strong><br />

Operat<strong>in</strong>g System Basics<br />

Computer Architecture<br />

Prof. Gustavo Alonso<br />

Prof. Thomas M. Stricker<br />

24.10.01 - 1 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


Who are we?<br />

Dozenten<br />

• Prof. Gustavo Alonso<br />

• Prof. Thomas M. Stricker<br />

Graduate assistants<br />

• W<strong>in</strong> Bausch<br />

• Ir<strong>in</strong>a Chihaia<br />

• Christian Kurmann<br />

• Cesare Pautasso<br />

• Andrei Popovici<br />

• Felix Rauch<br />

Undergraduate assistants<br />

• Rolf Bruderer<br />

• Beat Fluri<br />

• Patrick Grawehr<br />

• Hampa Hug<br />

• Slavisa Maslic<br />

• Dejan Radovic<br />

• Daniel Wagner<br />

• (tba)<br />

24.10.01 - 2 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


A little quizz ...<br />

• Who has used the Internet?<br />

... self taught?<br />

• Who programs regularly?<br />

... learned at ETH?<br />

... self taught?<br />

Biggest program ...<br />

..1000/10000/100000 LoC?<br />

• Have you built or configured your own<br />

computer?<br />

... self taught?<br />

• Ever programmed <strong>in</strong> assembler?<br />

... self taught?<br />

• Do you consider yourself a hacker?<br />

24.10.01 - 3 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


General objectives of the course<br />

• Work at the <strong>in</strong>terface between Hardware<br />

and Software.<br />

• Basics of computer architecture<br />

(<strong>in</strong>struction set)<br />

• Basic functionality of an operat<strong>in</strong>g<br />

system (user/system modes)<br />

• Introduction to the Art of Systems <strong>Programm<strong>in</strong>g</strong>.<br />

• Understand the software hierarchy <strong>in</strong><br />

a computer<br />

• programm<strong>in</strong>g tools and techniques<br />

• Introduction to the areas<br />

“System Software” und “Computer<br />

Architecture”<br />

• Operat<strong>in</strong>g systems<br />

• Compilers<br />

• Libraries (e.g., Communication)<br />

24.10.01 - 4 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


Concrete goals:<br />

• Introduction to Computer <strong>Programm<strong>in</strong>g</strong><br />

<strong>in</strong> C and <strong>Assembler</strong><br />

• Relation between C <strong>Assembler</strong><br />

• RISC Computer Architecture<br />

• SPARC V8 Computer Architecture<br />

from the po<strong>in</strong>t of view of the programmer<br />

• Introduction to UNIX<br />

• Operat<strong>in</strong>g System basics<br />

• Basic concepts of synchronous and<br />

asynchornous <strong>in</strong>terrupts<br />

• Basics of I/O operations<br />

• General<br />

Understand the way computers and complex<br />

software systems work and evolve<br />

• Last but not least ... have fun<br />

24.10.01 - 5 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


Course Program<br />

• Introduction and goals<br />

• System layer<strong>in</strong>g<br />

Operat<strong>in</strong>g system<br />

Compiler, assembler, l<strong>in</strong>ker<br />

Basics of computer architecture<br />

• <strong>Programm<strong>in</strong>g</strong> <strong>in</strong> C<br />

• SPARC Architecure<br />

• <strong>Programm<strong>in</strong>g</strong> <strong>in</strong> <strong>Assembler</strong><br />

• System <strong>in</strong>ternals<br />

Stacks<br />

Subrout<strong>in</strong>es<br />

Traps<br />

I/O Devices<br />

Signals<br />

24.10.01 - 6 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


Organization<br />

All you will ever need to know:<br />

http://www.<strong>in</strong>f.ethz.ch/<strong>37</strong>-<strong>023</strong><br />

Lecture: attendance recommended<br />

(Foils will be available before the lecture<br />

on the web page of the lecture)<br />

Exercises:<br />

• ca. 10 Series - 1 or 2 weeks each<br />

• 6 Assistants<br />

• Exercises to be solved <strong>in</strong> groups of 2-3<br />

• Gett<strong>in</strong>g the Testat = see the web pages<br />

• SunSparc <strong>in</strong> E22, E26.1,E19<br />

Textbook - Manual:<br />

R. P. Paul: SPARC Architecture, Assembly Language <strong>Programm<strong>in</strong>g</strong><br />

and C, Prentice Hall, 1994<br />

David L. Weaver/Tom Germond: SPARC Architecture Manual,<br />

Version 8 SPARC International Corp, Prentice Hall, 1992<br />

24.10.01 - 7 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


<strong>Programm<strong>in</strong>g</strong> environment:<br />

• SunSPARC Workstation (the real th<strong>in</strong>g)<br />

• GNU-C-Compiler on UNIX<br />

• Tkisem - SunSPARC V8 - Simulator<br />

• TKISEM for SUN<br />

• TKISEM <strong>in</strong> L<strong>in</strong>ux for W<strong>in</strong>Tel PC (at<br />

your own risk).<br />

Exam:<br />

• Written<br />

• Material from Lecture and exercises;<br />

programm<strong>in</strong>g required (but on paper)<br />

Requirements for the Testat:<br />

• Complete 8 of the 10 exercises<br />

• Exercises 9 are 10 are mandatory<br />

24.10.01 - 8 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


• Introduction to UNIX<br />

• Make, compiler<br />

Exercises<br />

• <strong>Programm<strong>in</strong>g</strong> <strong>in</strong> C: (1)<br />

• <strong>Programm<strong>in</strong>g</strong> <strong>in</strong> C: (2)<br />

• <strong>Programm<strong>in</strong>g</strong> <strong>in</strong> assembler<br />

arithmetic expressions<br />

control structures<br />

copy block<br />

Stackframes<br />

Traps<br />

Sun Serial Port (<strong>in</strong> C, but low level)<br />

• <strong>Programm<strong>in</strong>g</strong> Competition (how far can you<br />

optimize a program or why faster CPUs do not<br />

always help)<br />

not an exercise<br />

volunteers only<br />

great prices<br />

24.10.01 - 9 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker


Reference Books<br />

[1] R. P. Paul: SPARC Architecture, Assembly Language <strong>Programm<strong>in</strong>g</strong><br />

and C, Prentice Hall, 1994<br />

[2] Sparc International: The SPARC Architecture Manual Version<br />

8, Prentice Hall, 1992<br />

[3] B. Kernighan, D. Ritchie: The C <strong>Programm<strong>in</strong>g</strong> Language,<br />

2nd. Ed., Prentice Hall, 1988<br />

[4] C. Sexton: C Pocket Book. Butterworth-He<strong>in</strong>emann, 1991<br />

[5] D. Curry: Us<strong>in</strong>g C on the UNIX System, O’Reilly&Associates<br />

Inc., 1989<br />

[6] A. MacCabe: Computer Systems - Architecture, Organization<br />

and <strong>Programm<strong>in</strong>g</strong>, Irw<strong>in</strong> Inc., 1993<br />

[7] D. A. Patterson, J. L. Hennessy: Computer Organization &<br />

Design - The Hardware/Software Interface, Morgan Kaufmann<br />

Inc., 1994, 1-1-55860-281-X, this is Hennessy/Patterson<br />

Light(TM).<br />

[8] J. L. Hennessy, D. A. Patterson: Computer Architecture, A<br />

Quantitative Approach, Morgan Kaufmann Inc., 2nd Edition,<br />

1996, 1-55860-329-8, this is Hennessy/Patterson PRO(TM).<br />

[9] l.R. Dewar, M. Smosna: Microprocessors - A Programmer’s<br />

View. McGraw-Hill, 1990<br />

24.10.01 - 10 <strong>37</strong>-<strong>023</strong> Systems programm<strong>in</strong>g © Alonso/Stricker

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!