Notes For Unix Training ~ References ~ Contents ~ Overview ~ Unix History ~ Buzz Words ~ ======================================================================== Overview ~ OS is an interface between Application program and hardware. OS provides set of services. Training Contents Structure ~ ======================================================================== Course Title Duration(days) ======================================================================== UNIX Essentials & Shell Scripting 2 (OK) Data types, Data structures 3 (User defined data types) (Module 1) Good coding principles 1 Strings, Dynamic Memory, Heap, 4 Heap vs Stack (Module 2) (Up to Day 8) Strings: Day 2+5; List, Stack, Queues 3 [ Arrays, Dynamic memory Structs ] (Module 3) Pointers, Pointer Arithmetic, Castings (Module 4) 4 Sorting/Searching techniques on Linked List, 3 Arrays, Trees (Module 5) Argument passing (Module 6) 2 (But named as day 10 and 11 ??) Implement problems on collection of array, 3 list, dynamic memory, file operations (Module 7) Datacom Fundamentals 2 27 Days Total All Days Assignment Reviewed: contains assignments for 18 Days. ======================================================================== Unix System Programming_Module : 1 to 8 pptx each approx 55 slides. USP Module 1: Unix Architecture, File I/O, Strace, ltrace Module 2: Process Management Module 3: Signals and Resource Limits Module 4: Named and Unnamed Pipes Module 5: shared memory, mmap, msg queues Module 6: Semaphores Module 7: Socket Programming USP Module 8: libs, strace<race, proc, process mgmt ======================================================================== C Programming Modules Presentations : ======================================================================== Data types, Data structures (User defined data types)/C Programming_Module 1.pptx Data types, Data structures (User defined data types)/C Programming_Module 2.pptx Data types, Data structures (User defined data types)/C Programming_Module 3.pptx Strings, Dynamic Memory, Heap, Heap vs Stack/C Programming_Module 5.pptx Strings, Dynamic Memory, Heap, Heap vs Stack/C Programming_Module 6.pptx Strings, Dynamic Memory, Heap, Heap vs Stack/C Programming_Module 8.pptx Argument passing/C Programming_Module 9.pptx Argument passing/C Programming_Module 10.pptx Pointers, Pointer Arithmetic, Castings/C Programming_Module 11.pptx Pointers, Pointer Arithmetic, Castings/C Programming_Module 12.pptx List, Stack, Queues [ Arrays, Dynamic memory Structs ]/C Programming_Module 14.pptx List, Stack, Queues [ Arrays, Dynamic memory Structs ]/C Programming_Module 15.pptx ======================================================================== All Days Assignments Reviewed: DAY Day 1: Basics Day 2: Functions Day 3: Unix topic Day 4: Good Coding principles Day 5: Strings Day 6: Structure Day 7 and 8: Unix topic Day 9: Command line arguments Day 10: Files Day 11: Pointer Arithmetic Day 12: Function Pointers Day 13: Unix topic Day 14: List, Stack and Queue Day 15: Implementation of List, Stack and Queue Day 16: Sorting and Searching Day 17: Trees Day 18: Implementation of various sorting algorithms Day 19,20,21,22 and 23: Business Unit Case studies ======================================================================== Unix History ~ Mainframe - Earliest mainframes almost had no or diverse OS ! Just Hardware. Programs and data were accepted using punched papers. RAS critical factor. Very secure. IBM 700/7000, 360, zSeries (now) ... NCR, HoneyWell, GE, etc .. (Note: Now a days, Linux runs on IBM mainframe! RAS.) 1960's -- IBM focused on System/360 running OS/360. Later released DOS/360 for small System/360 models. DEC developed TOPS-10 and TOPS-20 time sharing systems Late 1960's - Unix Was developed at AT&T Bell labs. OS was written in mostly C (as against assembly code). Portable across hardware architecture and open specification. Widely accepted. DEC developed many OS including VMS operating system on VAX. Programs were typically written in assembly language. Most early implementation used 'microprogramming' (hardware design framework where processors were made to support instruction sets based on microprogramming which involved writing another kind of assembly code such as 'connect reg1,reg2 to input/output of ALU. Add, etc'; First generation minicomputers and workstations were born. The minicomputers didn't have a 'processor on chip' but involves sevaral printed circuit boards. Later, the primary means of portability shifted to using highlevel languages and specific compilers which may produce completely different assembly code. Mid 1970s - 8-bit processors (Intel 8080, Zilog-Z80, etc) used in home minicomputer and game consoles. 1980s - DOS - Disk OS became popular. IBM PC-DOS ran on 8080. MS-DOS ran on 8088 and 80x86 hardware. IBM introduced the notion of virtual machine, where OS runs on Hypervisor. VMware popularized this technology on personal computers. Over time, the line between virtual machines, monitors, and OS was blurred: Note: Minicomputer Vs Microcomputer : Microcomputer is based on microprocessor. Bus Architecture ~ Single system bus systems are also difficult to configure when constructed from common off-the-shelf equipment. Typically each added expansion card requires many jumpers in order to set memory addresses, I/O addresses, interrupt priorities, and interrupt numbers. Now a days plug-n-play software setup replaces/supplants jumpers. Notes ~ read() syscall reads size_t bytes which is defined as unsigned int; Only lseek64() should necessarily be 64 bit. (off64_t). You should do, for 64-bit offsets : #define _LARGEFILE64_SOURCE #include Use cc -E to preprocess the file ! Use strace -- trace syscalls Use ltrace -- trace library calls To get source code of linux commands : apt-get source coreutils More generally: http://ftp.gnu.org/gnu/coreutils/ ======================================================================== Buzz Words ~ Turing Machine ~ It is a finite state machine. Machine which has infinite (sequential) input and action is based only on the current symbol. At each step it can read the current block and modify that block. It can also go back and forth on the tape. Represents any algorithm. A (a-utomatic) turing machine which can simulate any other turing machine is called UTM -- universal turing machine. Introduced by Alan Turing on 1936. At any point of time, if state transition is ambiguous, and then based on external operator's choice, then it is c-choice turing machine. MIPS - Million Instructions Per second ~ FLOPS - Floating Point Ops Per second ~ Microprogramming ~ microcode == Processor's firmware. Sequence of microcode instructions implement processor's one instruction in the instruction set. Disk's firmware may be written in an assembly code of embedded processor. microprogram == Program written using microcode which implements an instruction set. A microprogram can be tested in simulator before distribution. microassembler == Provided by processor manufacturer to produce microcode that can be written to control-store of the processor.