Grundlagen der Betriebssystemprogrammierung

Size: px
Start display at page:

Download "Grundlagen der Betriebssystemprogrammierung"

Transcription

1 Grundlagen der Betriebssystemprogrammierung Präsentation A3, A4, A5, A6 21. März 2013 IAIK Grundlagen der Betriebssystemprogrammierung 1 / 73

2 1 A3 - Function Pointers 2 A4 - C++: The good, the bad and the ugly 3 A5 - Multithreading 4 A6 - Shell Grundlagen der Betriebssystemprogrammierung 2 / 73

3 Course Overview A10, A11, A12 OS Topics A7, A8, A9 Synchronization, Thread and Process Interaction A4, A5, A6 Multithreading, more C, more C++ A1, A2, A3 Git, Compiler, C, C++ Grundlagen der Betriebssystemprogrammierung 3 / 73

4 About Function Pointers Facts Pointer store the address of an object in memory. Integer pointers store the address of an integer. Function pointers store the address of a function. A function call includes a jump to an address (and back). This address is stored in a function pointer variable. Grundlagen der Betriebssystemprogrammierung 4 / 73

5 Function Pointer Syntax Declaration int (* my_main )(int, char **) = & main ; int (* my_main )(int, char **) = main ; void *(* start_ routine ) ( void *) = my_ thread ; The address-of operator & is optional. The parenthesis are important! The type must be correct! (Argument type & number, return type) Grundlagen der Betriebssystemprogrammierung 5 / 73

6 Function Pointer Syntax Usage int returnvalue = main ( argc, argv ); void * returndata = start_ routine ( input ); Like a statically defined function. Grundlagen der Betriebssystemprogrammierung 6 / 73

7 A3 - Function Pointers Task Overview Given: a source file with a static array and bubble sort implementation. main calls qsort (form C-library) and bsort to sort static array. void qsort ( void * base, size_ t num, size_ t size, int (* compar )( const void *, const void *)); sortandprintarray takes sort-function and compare-function to sort array. Define (typedef) two function pointer types for the sort and the compare function. Complete the bsort function. Call the appropriate sort function in sortandprintarray. Grundlagen der Betriebssystemprogrammierung 7 / 73

8 A3 - Function Pointers Task Overview Given: a source file with a static array and bubble sort implementation. main calls qsort (form C-library) and bsort to sort static array. void qsort ( void * base, size_ t num, size_ t size, int (* compar )( const void *, const void *)); sortandprintarray takes sort-function and compare-function to sort array. Define (typedef) two function pointer types for the sort and the compare function. Complete the bsort function. Call the appropriate sort function in sortandprintarray. Grundlagen der Betriebssystemprogrammierung 8 / 73

9 A3 - Function Pointers Task Overview Given: a source file with a static array and bubble sort implementation. main calls qsort (form C-library) and bsort to sort static array. void qsort ( void * base, size_ t num, size_ t size, int (* compar )( const void *, const void *)); sortandprintarray takes sort-function and compare-function to sort array. Define (typedef) two function pointer types for the sort and the compare function. Complete the bsort function. Call the appropriate sort function in sortandprintarray. Grundlagen der Betriebssystemprogrammierung 9 / 73

10 First Steps Pull upstream Read the wiki page. Learn about function pointers. Implement all lines marked with TODO. Grundlagen der Betriebssystemprogrammierung 10 / 73

11 Revisiting C++ Some thoughts about C++ In C++ it s harder to shoot yourself in the foot, but when you do, you blow off your whole leg. - Bjarne Stroustrup Grundlagen der Betriebssystemprogrammierung 11 / 73

12 Revisiting C++ Outline References and Pointers Templates Operator overloading STL and Containers RAII A4 - Revisiting C++ Grundlagen der Betriebssystemprogrammierung 12 / 73

13 References and Pointers What is a pointer? We know that already! int n = 41; int * ptr = &n; * ptr ++; // now n is 42 But what is a reference? Simplified: behaves like a pointer, but is syntactically used like a simple copy. int n = 42; int & ptr = n; ptr ++; // now n is 42 Grundlagen der Betriebssystemprogrammierung 13 / 73

14 References and Pointers What is a pointer? We know that already! int n = 41; int * ptr = &n; * ptr ++; // now n is 42 But what is a reference? Simplified: behaves like a pointer, but is syntactically used like a simple copy. int n = 42; int & ptr = n; ptr ++; // now n is 42 Grundlagen der Betriebssystemprogrammierung 14 / 73

15 References and Pointers What is a reference? more precisely: an alias for an object In contrast to pointers... no pointer-arithmetic each reference has to be initalised with a valid object no null-pointer for references Grundlagen der Betriebssystemprogrammierung 15 / 73

16 References and Pointers What is a reference? more precisely: an alias for an object In contrast to pointers... no pointer-arithmetic each reference has to be initalised with a valid object no null-pointer for references Grundlagen der Betriebssystemprogrammierung 16 / 73

17 References and Pointers Call by reference Changing an object by a function / method bool loadplayers ( std :: vector < Player * >& vec ); performance reasons: just pass a reference instead of copying the whole object. void displayplayers ( const std :: vector < Player * >& vec ) const ; const is important! Grundlagen der Betriebssystemprogrammierung 17 / 73

18 References and Pointers Call by reference Changing an object by a function / method bool loadplayers ( std :: vector < Player * >& vec ); performance reasons: just pass a reference instead of copying the whole object. void displayplayers ( const std :: vector < Player * >& vec ) const ; const is important! Grundlagen der Betriebssystemprogrammierung 18 / 73

19 Type Casting Implicit conversion int n = 1024; long m = n; // implicit type cast Explicit conversion dynamic cast static cast reinterpret cast C-style cast Grundlagen der Betriebssystemprogrammierung 19 / 73

20 Type Casting dynamic cast class Base { virtual void do () {} }; class Derived : public Base { }; Base * base = new Derived (); Derived * d = dynamic_cast < Derived * >( base ); works only with pointers and references to objects requires Run-time type information (RTTI) and a polymorphic object as operand used for downcasts (see example) runtime overhead (safe but slow) Grundlagen der Betriebssystemprogrammierung 20 / 73

21 Type Casting static cast checks done at compile time no runtime checks! be careful with casts between pointers to related classes! static cast performs conversions between... pointers to related classes. enums and integral types. floating point values and integral types. used for downcasts (see example) Grundlagen der Betriebssystemprogrammierung 21 / 73

22 Type Casting reinterpret cast converts any pointer to any pointer type reinterprets the given bits in a new way no checks done always possible results are system-specific and therefor not portable remember what Bjarne Stroustrup said! however sometimes it is necessary Low level code headers in a binary file data structures in file systems... Grundlagen der Betriebssystemprogrammierung 22 / 73

23 Type Casting reinterpret cast converts any pointer to any pointer type reinterprets the given bits in a new way no checks done always possible results are system-specific and therefor not portable remember what Bjarne Stroustrup said! however sometimes it is necessary Low level code headers in a binary file data structures in file systems... Grundlagen der Betriebssystemprogrammierung 23 / 73

24 Type Casting reinterpret cast low-level example struct minix_ super_ block { uint16 s_ ninodes ; uint16 s_ nzones ; uint16 s_ imap_ blocks ; uint16 s_ zmap_ blocks ; uint16 s_ firstdatazone ; uint16 s_ log_ zone_ size ; uint32 s_ max_ size ; uint16 s_ magic ; uint16 s_ state ; uint32 s_ zones ; }; Grundlagen der Betriebssystemprogrammierung 24 / 73

25 Type Casting reinterpret cast low-level example char buffer [ MINIX_ BLOCK_ SIZE ]; if (! device -> readsector ( sector, buffer, MINIX_BLOCK_SIZE )) { return false ; } minix_ super_ block superblock = * reinterpret_ cast < minix_ super_ block * >( buffer + offset ); Grundlagen der Betriebssystemprogrammierung 25 / 73

26 Templates What are templates? (Theory) Take a class/function definition Generalize it by allowing parameterization You have a template (class/function) What are templates? (Practice) Parameterization only works on types (and integral constants) Luckily, you can model (almost) anything using types Grundlagen der Betriebssystemprogrammierung 26 / 73

27 Templates What are templates? (Theory) Take a class/function definition Generalize it by allowing parameterization You have a template (class/function) What are templates? (Practice) Parameterization only works on types (and integral constants) Luckily, you can model (almost) anything using types Grundlagen der Betriebssystemprogrammierung 27 / 73

28 Templates, example We have: short max ( short a, short b) { return (a>b)?a:b; } That seems useful! Let s template it: template < typename T > T max1 (T a, T b) { return (a>b)?a:b; } That was easy! Templates are fun! Grundlagen der Betriebssystemprogrammierung 28 / 73

29 Templates, example We have: short max ( short a, short b) { return (a>b)?a:b; } That seems useful! Let s template it: template < typename T > T max1 (T a, T b) { return (a>b)?a:b; } That was easy! Templates are fun! Grundlagen der Betriebssystemprogrammierung 29 / 73

30 Templates, template parameters Consider again template < typename T > T max1 (T a, T b) { return (a>b)?a:b; } What assumptions do we make about T? Each T must be greater than -comparable. Compiler will reject any type that does not fulfill this Requirements on template parameters are important documentation! Grundlagen der Betriebssystemprogrammierung 30 / 73

31 Templates, pitfalls Back to our example. One problem: short a = 3; short b = max ( a, 5); // this works short c = max1 ( a, 5); // this does not prog.cpp:11: error: no matching function for call to max1(short int&, int) Template parameters must match exactly, no conversion is done by the compiler. Workarounds: short d = max1 < short >( a, 5); // Force specific instantiation short e = max1 (a, ( short )5); // Cast integer literal to short Grundlagen der Betriebssystemprogrammierung 31 / 73

32 Templates, pitfalls Back to our example. One problem: short a = 3; short b = max ( a, 5); // this works short c = max1 ( a, 5); // this does not prog.cpp:11: error: no matching function for call to max1(short int&, int) Template parameters must match exactly, no conversion is done by the compiler. Workarounds: short d = max1 < short >( a, 5); // Force specific instantiation short e = max1 (a, ( short )5); // Cast integer literal to short Grundlagen der Betriebssystemprogrammierung 32 / 73

33 Templates, ugly pitfalls What about classes? template < typename T > class A { public : typedef std :: vector <T > TVec ; }; template < typename T > class B: public A <T > { public : void fill ( const TVec & elements ); }; prog.cpp:11: error: expected, or... before & token prog.cpp:11: error: ISO C++ forbids declaration of TVec with no type Grundlagen der Betriebssystemprogrammierung 33 / 73

34 Templates, ugly pitfalls Let s try: void fill ( const A<T >:: TVec & elements ); prog.cpp:11: error: expected unqualified-id before & token prog.cpp:11: error: expected, or... before & token Not much better. What does the compiler think this is, if not a type? Grundlagen der Betriebssystemprogrammierung 34 / 73

35 Templates, typename A<T>::TVec may not name a type for every T template specialization. Consider: template<int> class A { public: static int TVec; }; If we instantiate B<int>, A<T>::TVec is not a type! Workaround: void fill ( const typename A <T >:: TVec & elements ); Assure the compiler This is a typename!. Grundlagen der Betriebssystemprogrammierung 35 / 73

36 Templates, typename A<T>::TVec may not name a type for every T template specialization. Consider: template<int> class A { public: static int TVec; }; If we instantiate B<int>, A<T>::TVec is not a type! Workaround: void fill ( const typename A <T >:: TVec & elements ); Assure the compiler This is a typename!. Grundlagen der Betriebssystemprogrammierung 36 / 73

37 Operator overloading All types used for max1 have to be greater than -comparable. What if we want to use our own class? Operator overloading! class Sortable { public : bool operator >( const Sortable & other ); }; Also useful to provide an intuitive interface to your class (e.g. for (mathematical) vectors, matrices,...). Note: Don t overdo it! Grundlagen der Betriebssystemprogrammierung 37 / 73

38 Standard containers The C++ standard library provides some container class templates: vector<t> list<t> map<k,t> set<k>... Important: Which requirements do T and K have to fulfill? Grundlagen der Betriebssystemprogrammierung 38 / 73

39 Container requirements Value types have to fulfill the following: Be copy-constructible Implements assigment operator Some operations also require: Be default-constructible Key types have to fulfill the following: Be copy-constructible Implements assigment operator Be less than -comparable (Ordering has to be a strict weak ordering) Some operations also require: Be default-constructible Grundlagen der Betriebssystemprogrammierung 39 / 73

40 Container requirements Value types have to fulfill the following: Be copy-constructible Implements assigment operator Some operations also require: Be default-constructible Key types have to fulfill the following: Be copy-constructible Implements assigment operator Be less than -comparable (Ordering has to be a strict weak ordering) Some operations also require: Be default-constructible Grundlagen der Betriebssystemprogrammierung 40 / 73

41 Iterators Containers define iterator types. These behave like pointers into the container void myfunc ( std :: vector <int > vec ) { for ( std :: vector <int >:: iterator it = vec. begin (); it!= vec. end (); ++ it) { std :: cout << (* it) << "\n"; } } Grundlagen der Betriebssystemprogrammierung 41 / 73

42 Iterators, why? Consider the following task: Provide a function to print an arbitrary number of integer values in a consistent format. What s better? void printvaluesptr ( int * ptr, int n); void printvaluesvec ( std :: vector <int > values ); Grundlagen der Betriebssystemprogrammierung 42 / 73

43 Iterators, why? Answer: Neither! Use templates! template < typename InputIterator > void printvaluestemplate ( InputIterator it, int n) { for ( int i = 0;i < n; ++i, ++ it) std :: cout << " value : " << (* it) << "\n"; } Pointers and iterators support the same interface (increment and dereferencing)! Grundlagen der Betriebssystemprogrammierung 43 / 73

44 std::map std::map<k,t> is an associative container mapping arbitrary (comparable) K s to T s. std :: map < std :: string, int > mymap ; int x = mymap [" key1 "]; What will happen? Answer: operator[] always returns a reference. If the entry does not exist, it will be created! if ( mymap. find (" key1 ")!= mymap. end ()) x = mymap [" key1 "]; map<k,t>::find(const K&) returns an iterator it will point one past the end (equal to map<k,t>::end()) in case the key is not found. Grundlagen der Betriebssystemprogrammierung 44 / 73

45 std::map std::map<k,t> is an associative container mapping arbitrary (comparable) K s to T s. std :: map < std :: string, int > mymap ; int x = mymap [" key1 "]; What will happen? Answer: operator[] always returns a reference. If the entry does not exist, it will be created! if ( mymap. find (" key1 ")!= mymap. end ()) x = mymap [" key1 "]; map<k,t>::find(const K&) returns an iterator it will point one past the end (equal to map<k,t>::end()) in case the key is not found. Grundlagen der Betriebssystemprogrammierung 45 / 73

46 RAII, basics Resource Acquisition Is Initialization - Acquiring and securely releasing resources. Bit of a misnomer: No one cares about acquisition, releasing resources is more important. Basic idea: Constructor acquires resource (file handle, memory, network connection,...), destructor frees it again. When the object is allocated on the stack (i.e. as a local variable), the destructor will be called automatically when the enclosing scope is left. Grundlagen der Betriebssystemprogrammierung 46 / 73

47 RAII, example # include < memory > int main () { std :: auto_ptr <int > myptr ( new int ); return 0; // Memory is freed automatically! } Too bad auto_ptr is pretty useless (not copy-able). Grundlagen der Betriebssystemprogrammierung 47 / 73

48 Better memory management using Shared Pointer Idea: Let s count how many references exist for a resource. When this count reaches zero, the resource can be freed. boost :: shared_ptr <int > myfunc () { boost :: shared_ptr <int > result ( new int ); return result ; // would not work with auto_ ptr } int main () { boost :: shared_ptr <int > myptr = myfunc (); return 0; // again, memory is freed automatically } Grundlagen der Betriebssystemprogrammierung 48 / 73

49 Better memory management using Shared Pointer shared_ptr maintains a reference counter Assignment operator and copy constructor make reference counter shared between different shared_ptrs to the same object Problem: Circular dependencies (reference count will always stay 1) Other problem : Only available in boost and C++11, but basic functionality is easy to implement Grundlagen der Betriebssystemprogrammierung 49 / 73

50 Placement new operator new does two things: Allocate memory Call constructor on allocated memory What if we only want to do the second? Placement new: new ( ptr ) MyClass (); Call constructor for MyClass on memory pointed to by ptr Potential uses: Memory pools, memory mapped hardware, shared memory But: There is almost always an alternative Grundlagen der Betriebssystemprogrammierung 50 / 73

51 Placement new operator new does two things: Allocate memory Call constructor on allocated memory What if we only want to do the second? Placement new: new ( ptr ) MyClass (); Call constructor for MyClass on memory pointed to by ptr Potential uses: Memory pools, memory mapped hardware, shared memory But: There is almost always an alternative Grundlagen der Betriebssystemprogrammierung 51 / 73

52 A4 - Revisiting C++ Task Overview Given: some C++ files. everything compiles fine but does not run... :( fix the code so that the program prodces the provided reference output. DO NOT change existing method signatures or members! You must NOT create any additional output! Just fix the bugs :) Grundlagen der Betriebssystemprogrammierung 52 / 73

53 A4 - Revisiting C++ Task Overview Given: some C++ files. everything compiles fine but does not run... :( fix the code so that the program prodces the provided reference output. DO NOT change existing method signatures or members! You must NOT create any additional output! Just fix the bugs :) Grundlagen der Betriebssystemprogrammierung 53 / 73

54 A4 - Revisiting C++ Task Overview Given: some C++ files. everything compiles fine but does not run... :( fix the code so that the program prodces the provided reference output. DO NOT change existing method signatures or members! You must NOT create any additional output! Just fix the bugs :) Grundlagen der Betriebssystemprogrammierung 54 / 73

55 First Steps Pull upstream Read the wiki page. Search all bugs and fix them. Rember the pitfalls we just discussed. Some of them are hidden in the code. Grundlagen der Betriebssystemprogrammierung 55 / 73

56 Threads and Processes The operating system.. can run multiple programs simultaneously. switches between running progams and shares the CPU Timesharing. decides when it switches. saves and restores the process context. provides a virtual CPU for every process, i.e. they don t notice that they share the CPU. Grundlagen der Betriebssystemprogrammierung 56 / 73

57 Threads and Processes A process.. is an instance of an executing program. has it s own virtual address space, separating it from other processes and the OS. has it s set of state variables (e.g. file descriptors) A thread.. is a sequential thread of execution in a program. belongs to a process (a userthread). is scheduled by the OS, i.e. granted CPU time. has it s own context: program counter, cpu registers,.. Grundlagen der Betriebssystemprogrammierung 57 / 73

58 Threads and Processes A process.. is an instance of an executing program. has it s own virtual address space, separating it from other processes and the OS. has it s set of state variables (e.g. file descriptors) A thread.. is a sequential thread of execution in a program. belongs to a process (a userthread). is scheduled by the OS, i.e. granted CPU time. has it s own context: program counter, cpu registers,.. Grundlagen der Betriebssystemprogrammierung 58 / 73

59 Threads and Processes When a program is started.. the OS creates a new process. the new process gets one new thread that starts at the program entry point. Multiple threads.. can be created within a process by using a library (that finally tells the OS). POSIX threads, pthreads. Every thread has it s own execution context. But within a process, all threads share the same address space and other process resources like file descriptors and others. Grundlagen der Betriebssystemprogrammierung 59 / 73

60 Threads and Processes When a program is started.. the OS creates a new process. the new process gets one new thread that starts at the program entry point. Multiple threads.. can be created within a process by using a library (that finally tells the OS). POSIX threads, pthreads. Every thread has it s own execution context. But within a process, all threads share the same address space and other process resources like file descriptors and others. Grundlagen der Betriebssystemprogrammierung 60 / 73

61 A5 - Multithreading Task Overview Given: a almost complete textmode game. An example for using multiple threads in a simple application. Thread 1 displays the gfx. Thread 2 waits for keyboard input. To do Pull upstream. Read the wiki. Run the second thread Play the game. Submit. Grundlagen der Betriebssystemprogrammierung 61 / 73

62 A6 - Shell Task Overview Minimal Shell TODOs in the code: 1 Process creation 2 Pipe commands, <, >, etc. First Steps Pull upstream Try make and execute the shell Grundlagen der Betriebssystemprogrammierung 62 / 73

63 A6 - Shell Process Creation Windows way: CreateProcess Unix way: fork, exec Fork Creates a new process. Shall be an exact copy... Exec Replaces current process image (Tries to) execute the given binary file Grundlagen der Betriebssystemprogrammierung 63 / 73

64 A6 - Shell Fork Example # include <unistd.h> // pid_t fork ( void ); int pid = fork (); if ( pid == 0) printf ("I m the child \n"); else printf ("I m the parent," " and my child has pid %u\n", pid ); Grundlagen der Betriebssystemprogrammierung 64 / 73

65 A6 - Shell Exec Example # include <unistd.h> char * const input_argv [] = {" file. txt ", 0}; // int execv ( const char * path, // char * const argv []) ; execv ("/ bin / vim ", input_argv ); printf (" If program flow gets here " " something went terribly wrong!\ n"); exit ( -1); Grundlagen der Betriebssystemprogrammierung 65 / 73

66 A6 - Shell Process Creation fork followed by an exec? Worse than the CreateProcess approach? No, because of cow: Forked process shares memory with the old process Memory is copied upon write access Almost nothing copied if followed by an exec! But how do i get output of the new process? Pipes! Grundlagen der Betriebssystemprogrammierung 66 / 73

67 A6 - Shell File Descriptors A file descriptor has type int You know FILE*? FILE struct contains file descriptor (abstraction) fopen open fread read etc. Grundlagen der Betriebssystemprogrammierung 67 / 73

68 A6 - Shell Pipes a pair of 2 special file descriptors read end and write end # include <unistd.h> int pipefd [2]; // int pipe ( int pipefd [2]) ; pipe ( pipefd ); write ( pipefd [1], " hello world \n", 12) ; // might block char text [13]; read ( pipefd [0], text, 12) ; // will block ( if no input available ) Grundlagen der Betriebssystemprogrammierung 68 / 73

69 A6 - Shell How to use pipes instead of STDOUT FILENO, etc.? fork/exec leave file descriptors as they are! But how to change STDOUT FILENO to a pipe write end? dup2! int fd = open (" output. txt ", O_RDWR O_CREAT O_TRUNC ); dup2 (fd, STDOUT_FILENO ); printf (" this will be written to output. txt, but NOT to the terminal!"); Grundlagen der Betriebssystemprogrammierung 69 / 73

70 A6 - Shell How to wait until a process terminated? # include <sys / types.h> # include <sys / wait.h> int pid = fork (); if ( pid == 0) { // do something exit (0) ; } // pid_t waitpid ( pid_t pid, int * status, // int options ); waitpid ( pid, 0, 0); // look at the man page Grundlagen der Betriebssystemprogrammierung 70 / 73

71 A6 - Shell # define READ_ STDOUT_ FILENO pipe [0] # define WRITE_ STDOUT_ FILENO pipe [1] int pipe [2]; pipe ( pipe ); int pid = fork (); if ( pid == 0) { dup2 ( WRITE_ STDOUT_ FILENO, STDOUT_ FILENO ); close ( READ_STDOUT_FILENO ); // why? execv ( path_, ( char * const *) args_ ); } waitpid ( child, 0, 0); close ( WRITE_STDOUT_FILENO ); // why? read ( READ_ STDOUT_ FILENO, buf, BUFFER_ SIZE ); close ( READ_STDOUT_FILENO ); Grundlagen der Betriebssystemprogrammierung 71 / 73

72 A6 - Shell Pipes in the shell./prog1 < file.txt 1 Open file.txt 2 Read from file, write into pipe 3 Replace STDIN FILENO of forked process by this pipe (dup2)./prog1 > file.txt 1 Open file.txt 2 Replace STDOUT FILENO of forked process by a pipe 3 Read from pipe, write into file ls less 1 Run ls with STDOUT FILENO replaced by pipe[1] 2 Run less with STDIN FILENO replaced by pipe[0] etc. Grundlagen der Betriebssystemprogrammierung 72 / 73

73 Thanks for your Attention! Grundlagen der Betriebssystemprogrammierung 73 / 73

System Calls and Standard I/O

System Calls and Standard I/O System Calls and Standard I/O Professor Jennifer Rexford http://www.cs.princeton.edu/~jrex 1 Goals of Today s Class System calls o How a user process contacts the Operating System o For advanced services

More information

C++ Programming Language

C++ Programming Language C++ Programming Language Lecturer: Yuri Nefedov 7th and 8th semesters Lectures: 34 hours (7th semester); 32 hours (8th semester). Seminars: 34 hours (7th semester); 32 hours (8th semester). Course abstract

More information

An Incomplete C++ Primer. University of Wyoming MA 5310

An Incomplete C++ Primer. University of Wyoming MA 5310 An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages

More information

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes

How To Understand How A Process Works In Unix (Shell) (Shell Shell) (Program) (Unix) (For A Non-Program) And (Shell).Orgode) (Powerpoint) (Permanent) (Processes Content Introduction and History File I/O The File System Shell Programming Standard Unix Files and Configuration Processes Programs are instruction sets stored on a permanent medium (e.g. harddisc). Processes

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes

Computer Systems II. Unix system calls. fork( ) wait( ) exit( ) How To Create New Processes? Creating and Executing Processes Computer Systems II Creating and Executing Processes 1 Unix system calls fork( ) wait( ) exit( ) 2 How To Create New Processes? Underlying mechanism - A process runs fork to create a child process - Parent

More information

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas CS 110B - Rule Storage Classes Page 18-1 Attributes are distinctive features of a variable. Data type, int or double for example, is an attribute. Storage class is another attribute. There are four storage

More information

C++ INTERVIEW QUESTIONS

C++ INTERVIEW QUESTIONS C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get

More information

The programming language C. sws1 1

The programming language C. sws1 1 The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan

More information

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17

CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 CSI 402 Lecture 13 (Unix Process Related System Calls) 13 1 / 17 System Calls for Processes Ref: Process: Chapter 5 of [HGS]. A program in execution. Several processes are executed concurrently by the

More information

1 Posix API vs Windows API

1 Posix API vs Windows API 1 Posix API vs Windows API 1.1 File I/O Using the Posix API, to open a file, you use open(filename, flags, more optional flags). If the O CREAT flag is passed, the file will be created if it doesnt exist.

More information

/* File: blkcopy.c. size_t n

/* File: blkcopy.c. size_t n 13.1. BLOCK INPUT/OUTPUT 505 /* File: blkcopy.c The program uses block I/O to copy a file. */ #include main() { signed char buf[100] const void *ptr = (void *) buf FILE *input, *output size_t

More information

Informatica e Sistemi in Tempo Reale

Informatica e Sistemi in Tempo Reale Informatica e Sistemi in Tempo Reale Introduction to C programming Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 25, 2010 G. Lipari (Scuola Superiore Sant Anna)

More information

Sources: On the Web: Slides will be available on:

Sources: On the Web: Slides will be available on: C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II Introduction to C++ Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 20, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science

First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca

More information

Illustration 1: Diagram of program function and data flow

Illustration 1: Diagram of program function and data flow The contract called for creation of a random access database of plumbing shops within the near perimeter of FIU Engineering school. The database features a rating number from 1-10 to offer a guideline

More information

University of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python

University of Hull Department of Computer Science. Wrestling with Python Week 01 Playing with Python Introduction Welcome to our Python sessions. University of Hull Department of Computer Science Wrestling with Python Week 01 Playing with Python Vsn. 1.0 Rob Miles 2013 Please follow the instructions carefully.

More information

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015

Linux/UNIX System Programming. POSIX Shared Memory. Michael Kerrisk, man7.org c 2015. February 2015 Linux/UNIX System Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2015 February 2015 Outline 22 POSIX Shared Memory 22-1 22.1 Overview 22-3 22.2 Creating and opening shared memory objects 22-10

More information

C++ for Safety-Critical Systems. DI Günter Obiltschnig Applied Informatics Software Engineering GmbH guenter.obiltschnig@appinf.

C++ for Safety-Critical Systems. DI Günter Obiltschnig Applied Informatics Software Engineering GmbH guenter.obiltschnig@appinf. C++ for Safety-Critical Systems DI Günter Obiltschnig Applied Informatics Software Engineering GmbH guenter.obiltschnig@appinf.com A life-critical system or safety-critical system is a system whose failure

More information

C++FA 5.1 PRACTICE MID-TERM EXAM

C++FA 5.1 PRACTICE MID-TERM EXAM C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer

More information

Crash Course in Java

Crash Course in Java Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is

More information

Jorix kernel: real-time scheduling

Jorix kernel: real-time scheduling Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and

More information

Java Interview Questions and Answers

Java Interview Questions and Answers 1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java

More information

16 Collection Classes

16 Collection Classes 16 Collection Classes Collections are a key feature of the ROOT system. Many, if not most, of the applications you write will use collections. If you have used parameterized C++ collections or polymorphic

More information

Tutorial on C Language Programming

Tutorial on C Language Programming Tutorial on C Language Programming Teodor Rus rus@cs.uiowa.edu The University of Iowa, Department of Computer Science Introduction to System Software p.1/64 Tutorial on C programming C program structure:

More information

Binary storage of graphs and related data

Binary storage of graphs and related data EÖTVÖS LORÁND UNIVERSITY Faculty of Informatics Department of Algorithms and their Applications Binary storage of graphs and related data BSc thesis Author: Frantisek Csajka full-time student Informatics

More information

Threads Scheduling on Linux Operating Systems

Threads Scheduling on Linux Operating Systems Threads Scheduling on Linux Operating Systems Igli Tafa 1, Stavri Thomollari 2, Julian Fejzaj 3 Polytechnic University of Tirana, Faculty of Information Technology 1,2 University of Tirana, Faculty of

More information

vector vec double # in # cl in ude <s ude tdexcept> tdexcept> // std::ou std t_of ::ou _range t_of class class V Vector { ector {

vector vec double # in # cl in ude <s ude tdexcept> tdexcept> // std::ou std t_of ::ou _range t_of class class V Vector { ector { Software Design (C++) 3. Resource management and exception safety (idioms and technicalities) Juha Vihavainen University of Helsinki Preview More on error handling and exceptions checking array indices

More information

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is

Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is Multichoice Quetions 1. Atributes a. are listed in the second part of the class box b. its time is preceded by a colon. c. its default value is preceded by an equal sign d. its name has undereline 2. Associations

More information

CSC230 Getting Starting in C. Tyler Bletsch

CSC230 Getting Starting in C. Tyler Bletsch CSC230 Getting Starting in C Tyler Bletsch What is C? The language of UNIX Procedural language (no classes) Low-level access to memory Easy to map to machine language Not much run-time stuff needed Surprisingly

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

Operator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax -- First Example

Operator Overloading. Lecture 8. Operator Overloading. Running Example: Complex Numbers. Syntax. What can be overloaded. Syntax -- First Example Operator Overloading Lecture 8 Operator Overloading C++ feature that allows implementer-defined classes to specify class-specific function for operators Benefits allows classes to provide natural semantics

More information

Curriculum Map. Discipline: Computer Science Course: C++

Curriculum Map. Discipline: Computer Science Course: C++ Curriculum Map Discipline: Computer Science Course: C++ August/September: How can computer programs make problem solving easier and more efficient? In what order does a computer execute the lines of code

More information

System Calls Related to File Manipulation

System Calls Related to File Manipulation KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 12 System Calls Related to File Manipulation Objective: In this lab we will be

More information

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON

PROBLEM SOLVING SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON PROBLEM SOLVING WITH SEVENTH EDITION WALTER SAVITCH UNIVERSITY OF CALIFORNIA, SAN DIEGO CONTRIBUTOR KENRICK MOCK UNIVERSITY OF ALASKA, ANCHORAGE PEARSON Addison Wesley Boston San Francisco New York London

More information

Object Oriented Software Design II

Object Oriented Software Design II Object Oriented Software Design II C++ intro Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa February 26, 2012 G. Lipari (Scuola Superiore Sant Anna) C++ Intro February 26,

More information

Why you shouldn't use set (and what you should use instead) Matt Austern

Why you shouldn't use set (and what you should use instead) Matt Austern Why you shouldn't use set (and what you should use instead) Matt Austern Everything in the standard C++ library is there for a reason, but it isn't always obvious what that reason is. The standard isn't

More information

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study CS 377: Operating Systems Lecture 25 - Linux Case Study Guest Lecturer: Tim Wood Outline Linux History Design Principles System Overview Process Scheduling Memory Management File Systems A review of what

More information

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

KITES TECHNOLOGY COURSE MODULE (C, C++, DS) KITES TECHNOLOGY 360 Degree Solution www.kitestechnology.com/academy.php info@kitestechnology.com technologykites@gmail.com Contact: - 8961334776 9433759247 9830639522.NET JAVA WEB DESIGN PHP SQL, PL/SQL

More information

6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang

6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang 6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang Today s topics Why objects? Object-oriented programming (OOP) in C++ classes fields & methods objects representation

More information

CORBA Programming with TAOX11. The C++11 CORBA Implementation

CORBA Programming with TAOX11. The C++11 CORBA Implementation CORBA Programming with TAOX11 The C++11 CORBA Implementation TAOX11: the CORBA Implementation by Remedy IT TAOX11 simplifies development of CORBA based applications IDL to C++11 language mapping is easy

More information

Integrating the C++ Standard Template Library Into the Undergraduate Computer Science Curriculum

Integrating the C++ Standard Template Library Into the Undergraduate Computer Science Curriculum Integrating the C++ Standard Template Library Into the Undergraduate Computer Science Curriculum James P. Kelsh James.Kelsh@cmich.edu Roger Y. Lee lee@cps.cmich.edu Department of Computer Science Central

More information

N3458: Simple Database Integration in C++11

N3458: Simple Database Integration in C++11 N3458: Simple Database Integration in C++11 Thomas Neumann Technische Univeristät München neumann@in.tum.de 2012-10-22 Many applications make use of relational database to store and query their data. However,

More information

OpenCL Static C++ Kernel Language Extension

OpenCL Static C++ Kernel Language Extension OpenCL Static C++ Kernel Language Extension Document Revision: 04 Advanced Micro Devices Authors: Ofer Rosenberg, Benedict R. Gaster, Bixia Zheng, Irina Lipov December 15, 2011 Contents 1 Overview... 3

More information

Lab 4: Socket Programming: netcat part

Lab 4: Socket Programming: netcat part Lab 4: Socket Programming: netcat part Overview The goal of this lab is to familiarize yourself with application level programming with sockets, specifically stream or TCP sockets, by implementing a client/server

More information

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005

Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY. 6.828 Operating System Engineering: Fall 2005 Department of Electrical Engineering and Computer Science MASSACHUSETTS INSTITUTE OF TECHNOLOGY 6.828 Operating System Engineering: Fall 2005 Quiz II Solutions Average 84, median 83, standard deviation

More information

Operating Systems and Networks

Operating Systems and Networks recap Operating Systems and Networks How OS manages multiple tasks Virtual memory Brief Linux demo Lecture 04: Introduction to OS-part 3 Behzad Bordbar 47 48 Contents Dual mode API to wrap system calls

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

More information

C++FA 3.1 OPTIMIZING C++

C++FA 3.1 OPTIMIZING C++ C++FA 3.1 OPTIMIZING C++ Ben Van Vliet Measuring Performance Performance can be measured and judged in different ways execution time, memory usage, error count, ease of use and trade offs usually have

More information

C++ Language Tutorial

C++ Language Tutorial cplusplus.com C++ Language Tutorial Written by: Juan Soulié Last revision: June, 2007 Available online at: http://www.cplusplus.com/doc/tutorial/ The online version is constantly revised and may contain

More information

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct

Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Dr. Martin O. Steinhauser University of Basel Graduate Lecture Spring Semester 2014 Molecular Dynamics Simulations with Applications in Soft Matter Handout 7 Memory Diagram of a Struct Friday, 7 th March

More information

Operating Systems. Privileged Instructions

Operating Systems. Privileged Instructions Operating Systems Operating systems manage processes and resources Processes are executing instances of programs may be the same or different programs process 1 code data process 2 code data process 3

More information

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters The char Type ASCII Encoding The C char type stores small integers. It is usually 8 bits. char variables guaranteed to be able to hold integers 0.. +127. char variables mostly used to store characters

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

More information

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.

Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program. Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to

More information

OS: IPC I. Cooperating Processes. CIT 595 Spring 2010. Message Passing vs. Shared Memory. Message Passing: Unix Pipes

OS: IPC I. Cooperating Processes. CIT 595 Spring 2010. Message Passing vs. Shared Memory. Message Passing: Unix Pipes Cooperating Processes Independent processes cannot affect or be affected by the execution of another process OS: IPC I CIT 595 Spring 2010 Cooperating process can affect or be affected by the execution

More information

Variable Base Interface

Variable Base Interface Chapter 6 Variable Base Interface 6.1 Introduction Finite element codes has been changed a lot during the evolution of the Finite Element Method, In its early times, finite element applications were developed

More information

Getting Started with the Internet Communications Engine

Getting Started with the Internet Communications Engine Getting Started with the Internet Communications Engine David Vriezen April 7, 2014 Contents 1 Introduction 2 2 About Ice 2 2.1 Proxies................................. 2 3 Setting Up ICE 2 4 Slices 2

More information

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction

IS0020 Program Design and Software Tools Midterm, Feb 24, 2004. Instruction IS0020 Program Design and Software Tools Midterm, Feb 24, 2004 Name: Instruction There are two parts in this test. The first part contains 50 questions worth 80 points. The second part constitutes 20 points

More information

5 Arrays and Pointers

5 Arrays and Pointers 5 Arrays and Pointers 5.1 One-dimensional arrays Arrays offer a convenient way to store and access blocks of data. Think of arrays as a sequential list that offers indexed access. For example, a list of

More information

Lecture 24 Systems Programming in C

Lecture 24 Systems Programming in C Lecture 24 Systems Programming in C A process is a currently executing instance of a program. All programs by default execute in the user mode. A C program can invoke UNIX system calls directly. A system

More information

Lecture 25 Systems Programming Process Control

Lecture 25 Systems Programming Process Control Lecture 25 Systems Programming Process Control A process is defined as an instance of a program that is currently running. A uni processor system or single core system can still execute multiple processes

More information

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions Phys4051: C Lecture 2 & 3 Functions (Review) Comment Statements Variables & Operators Branching Instructions Comment Statements! Method 1: /* */! Method 2: // /* Single Line */ //Single Line /* This comment

More information

CSC 2405: Computer Systems II

CSC 2405: Computer Systems II CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building mirela.damian@villanova.edu

More information

Facebook Twitter YouTube Google Plus Website Email

Facebook Twitter YouTube Google Plus Website Email PHP MySQL COURSE WITH OOP COURSE COVERS: PHP MySQL OBJECT ORIENTED PROGRAMMING WITH PHP SYLLABUS PHP 1. Writing PHP scripts- Writing PHP scripts, learn about PHP code structure, how to write and execute

More information

1 Abstract Data Types Information Hiding

1 Abstract Data Types Information Hiding 1 1 Abstract Data Types Information Hiding 1.1 Data Types Data types are an integral part of every programming language. ANSI-C has int, double and char to name just a few. Programmers are rarely content

More information

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

More information

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version

3.5. cmsg Developer s Guide. Data Acquisition Group JEFFERSON LAB. Version Version 3.5 JEFFERSON LAB Data Acquisition Group cmsg Developer s Guide J E F F E R S O N L A B D A T A A C Q U I S I T I O N G R O U P cmsg Developer s Guide Elliott Wolin wolin@jlab.org Carl Timmer timmer@jlab.org

More information

System Security Fundamentals

System Security Fundamentals System Security Fundamentals Alessandro Barenghi Dipartimento di Elettronica, Informazione e Bioingegneria Politecnico di Milano alessandro.barenghi - at - polimi.it April 28, 2015 Lesson contents Overview

More information

Qt Signals and Slots. Olivier Goffart. October 2013

Qt Signals and Slots. Olivier Goffart. October 2013 Qt Signals and Slots Olivier Goffart October 2013 About Me About Me QStyleSheetStyle Itemviews Animation Framework QtScript (porting to JSC and V8) QObject, moc QML Debugger Modularisation... About Me

More information

Semantic Analysis: Types and Type Checking

Semantic Analysis: Types and Type Checking Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

More information

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011

INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information

MPLAB TM C30 Managed PSV Pointers. Beta support included with MPLAB C30 V3.00

MPLAB TM C30 Managed PSV Pointers. Beta support included with MPLAB C30 V3.00 MPLAB TM C30 Managed PSV Pointers Beta support included with MPLAB C30 V3.00 Contents 1 Overview 2 1.1 Why Beta?.............................. 2 1.2 Other Sources of Reference..................... 2 2

More information

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies)

Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Course Name: ADVANCE COURSE IN SOFTWARE DEVELOPMENT (Specialization:.Net Technologies) Duration of Course: 6 Months Fees: Rs. 25,000/- (including Service Tax) Eligibility: B.E./B.Tech., M.Sc.(IT/ computer

More information

El Dorado Union High School District Educational Services

El Dorado Union High School District Educational Services El Dorado Union High School District Course of Study Information Page Course Title: ACE Computer Programming II (#495) Rationale: A continuum of courses, including advanced classes in technology is needed.

More information

CS355 Hw 3. Extended Shell with Job Control

CS355 Hw 3. Extended Shell with Job Control CS355 Hw 3 Due by the end of day Tuesday, Mar 18. Design document due on Thursday, Feb 27 in class. Written supplementary problems due on Thursday, March 6. Programming Assignment: You should team up with

More information

Keil C51 Cross Compiler

Keil C51 Cross Compiler Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation

More information

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement? 1. Distinguish & and && operators. PART-A Questions 2. How does an enumerated statement differ from a typedef statement? 3. What are the various members of a class? 4. Who can access the protected members

More information

Outline. Review. Inter process communication Signals Fork Pipes FIFO. Spotlights

Outline. Review. Inter process communication Signals Fork Pipes FIFO. Spotlights Outline Review Inter process communication Signals Fork Pipes FIFO Spotlights 1 6.087 Lecture 14 January 29, 2010 Review Inter process communication Signals Fork Pipes FIFO Spotlights 2 Review: multithreading

More information

Libmonitor: A Tool for First-Party Monitoring

Libmonitor: A Tool for First-Party Monitoring Libmonitor: A Tool for First-Party Monitoring Mark W. Krentel Dept. of Computer Science Rice University 6100 Main St., Houston, TX 77005 krentel@rice.edu ABSTRACT Libmonitor is a library that provides

More information

ELEC 377. Operating Systems. Week 1 Class 3

ELEC 377. Operating Systems. Week 1 Class 3 Operating Systems Week 1 Class 3 Last Class! Computer System Structure, Controllers! Interrupts & Traps! I/O structure and device queues.! Storage Structure & Caching! Hardware Protection! Dual Mode Operation

More information

Operating System Structure

Operating System Structure Operating System Structure Lecture 3 Disclaimer: some slides are adopted from the book authors slides with permission Recap Computer architecture CPU, memory, disk, I/O devices Memory hierarchy Architectural

More information

Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm

Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters

More information

Beyond the Mouse A Short Course on Programming

Beyond the Mouse A Short Course on Programming 1 / 22 Beyond the Mouse A Short Course on Programming 2. Fundamental Programming Principles I: Variables and Data Types Ronni Grapenthin Geophysical Institute, University of Alaska Fairbanks September

More information

Virtual Servers. Virtual machines. Virtualization. Design of IBM s VM. Virtual machine systems can give everyone the OS (and hardware) that they want.

Virtual Servers. Virtual machines. Virtualization. Design of IBM s VM. Virtual machine systems can give everyone the OS (and hardware) that they want. Virtual machines Virtual machine systems can give everyone the OS (and hardware) that they want. IBM s VM provided an exact copy of the hardware to the user. Virtual Servers Virtual machines are very widespread.

More information

Leak Check Version 2.1 for Linux TM

Leak Check Version 2.1 for Linux TM Leak Check Version 2.1 for Linux TM User s Guide Including Leak Analyzer For x86 Servers Document Number DLC20-L-021-1 Copyright 2003-2009 Dynamic Memory Solutions LLC www.dynamic-memory.com Notices Information

More information

File Systems Management and Examples

File Systems Management and Examples File Systems Management and Examples Today! Efficiency, performance, recovery! Examples Next! Distributed systems Disk space management! Once decided to store a file as sequence of blocks What s the size

More information

Linux Kernel Architecture

Linux Kernel Architecture Linux Kernel Architecture Amir Hossein Payberah payberah@yahoo.com Contents What is Kernel? Kernel Architecture Overview User Space Kernel Space Kernel Functional Overview File System Process Management

More information

Shared Memory Introduction

Shared Memory Introduction 12 Shared Memory Introduction 12.1 Introduction Shared memory is the fastest form of IPC available. Once the memory is mapped into the address space of the processes that are sharing the memory region,

More information

Chapter 6, The Operating System Machine Level

Chapter 6, The Operating System Machine Level Chapter 6, The Operating System Machine Level 6.1 Virtual Memory 6.2 Virtual I/O Instructions 6.3 Virtual Instructions For Parallel Processing 6.4 Example Operating Systems 6.5 Summary Virtual Memory General

More information

XMOS Programming Guide

XMOS Programming Guide XMOS Programming Guide Document Number: Publication Date: 2014/10/9 XMOS 2014, All Rights Reserved. XMOS Programming Guide 2/108 SYNOPSIS This document provides a consolidated guide on how to program XMOS

More information

Object Oriented Software Design

Object Oriented Software Design Object Oriented Software Design Introduction to Java - II Giuseppe Lipari http://retis.sssup.it/~lipari Scuola Superiore Sant Anna Pisa October 28, 2010 G. Lipari (Scuola Superiore Sant Anna) Introduction

More information

To Java SE 8, and Beyond (Plan B)

To Java SE 8, and Beyond (Plan B) 11-12-13 To Java SE 8, and Beyond (Plan B) Francisco Morero Peyrona EMEA Java Community Leader 8 9...2012 2020? Priorities for the Java Platforms Grow Developer Base Grow Adoption

More information