Lec10 Heap Behind the Curtain (Arif Butt @ PUCIT)


This session start with a discussion on types of heap allocators. A quick review on malloc family of functions for allocating, using and freeing unnamed memory on heap. Role of system calls brk() and sbrk() in management of heap. The basic data structures used in management of heap for allocated and unallocated blocks. Common programming errors related to heap management. Tools and libraries for malloc debugging like splint, electric-fence, and Valgrind.

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec11 Design and Code of UNIX more utility (Arif Butt @ PUCIT)


This session deals with the design and development of UNIX more utility. It starts with the discussion of “What more do?”, then “How more do it?”, and finally different versions of more utility are designed and coded.

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec12 UNIX File System Architecture (Arif Butt @ PUCIT)


In this session will start with a quick recap of hard disk partitioning, formatting and mounting. The internal structure of UNIX file system (Disk, partitions, boot block, super block, inode block) are described in detail. Connection to an open file via PPFDT is discussed. The session will close with the concept of UNIX Universal I/O model (open-read-write-close paradigm).

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec13 UNIX File Management (Arif Butt @ PUCIT)


This session will deal with various file related system calls. It starts with repositioning the current file offset using lseek(). Creating soft link to a file, changing permissions, and ownership of a file from within a C program. Different techniques of I/O redirection are discussed using dup() and dup2() system calls. Finally, the use of fcntl() system call is discussed to duplicate a file descriptor, get/set file descriptor flags in PPFDT, get/set file status flags in SWFT, and achieving advisory locks on files

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec14 Design and Code of UNIX ls Utility (Arif Butt @ PUCIT)


This session deals with the designing the ls program. First we will see what actually ls do? by digging in the details of its various options. Then we will try to understand how ls actually do it? Finally we will start writing different versions of the ls utility. We sill start from the very basic program that displays the listing of present working directory and finally we will write an ls program that shows the long listing of files of the directories passed as command line arguments.

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec15 Design and Code Of UNIX who Utility (Arif Butt @ PUCIT)


This session deals with the different categories of OS configuration files as well as of different programs that we install on our Linux machine. Their importance in correct execution of different programs and services is discussed. Then we will start with the design of UNIX who utility. First we will see what who do? Then we will try to understand how who actually do it? Finally we will start writing different versions of the who utility. I will also discuss the concept off buffering done by our application programs and the OS kernel as well.

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec16 Programming Terminal Devices (Arif Butt @ PUCIT)


This session starts with character and block special files and their attributes. The terminal devices are discussed in detail by reading and writing the terminal devices. The attributes of terminal driver (Input, output, control, and local processing) are discussed in detail. Modifying terminal attributes on the shell using stty command is shown. The two main modes of terminal driver Canonical and non-canonical are discussed. Finally accessing and modifying the terminal attributes from within a C program using system(), tcgetattr(), tcsetattr() and ioctl() system call are discussed in details with example codes.

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec17 Process Management-I (Arif Butt @ PUCIT)


This session starts with a quick recap of processes in Linux by giving an overview of the data structures maintained by Linux kernel to manage processes. We will discuss different identifications related to processes and their usage. The famous fork() system call is discussed in detail with example codes. Finally we will discuss the concept of process trees, chains and fans.

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src

Lec18 Process Management-II (Arif Butt @ PUCIT)


This session starts with a comparison between the fork() and the vfork() system call. We will discuss how the newer versions of fork() use the copy on write semantics. The concept of zombie and orphan processes are discussed. Then we will discuss different system calls that are used for monitoring the status of child processes like wait(), waitpid(), waitid(), wait3(), and wait4()

Email: arif@pucit.edu.pk
Example Codes: https://bitbucket.org/arifpucit/spvl-repo/src