sp with linux

LEC01 INTRODUCTION TO SYSTEM PROGRAMMING


This is the first session on the subject of System Programming with Linux. It starts with a discussion on application vs system programmer perspective. Describes briefly about a system call and how it works. A detailed discussion on Course Matrix.

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

Lec02 C Compilation: A System Programmer Perspective


This session starts with the C-Compilation process from system programmer perspective. The contents of intermediate files are discussed using readelf and objdump commands. The executable is loaded in gdb and the contents of CPU registers are shown. How a C program actually makes a system call is described in detail by making a system call with and without wrapper and finally calling a system call from within an assembly program.

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

Lec03 Working of Linkers: Creating your own Libraries


Linking and loading a process (Behind the curtain). Load time and run time dynamic linking. Structure of ELF file format. Merging re-locatable object files into executable. What is relocation. Symbol (global, external, local) resolution. Strong and weak symbols. Linker symbol rules for multiple strong and weak symbols. Creating and using your own static libraries. Creating and using your own dynamic libraries or shared objects. (Tools used are nm, ar, ranlib)

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

Lec04 UNIX make utility


This session deals with the famous UNIX make utility. Starts with its introduction, how it works and how to write a basic Makefile. Using your own and built-in macros in a Makefile. Writing and calling multiple make files for a program

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

Lec05 GNU autotools and cmake


This session starts with a brief comparison between binary and open source software packages, their downloading and installation. We start with the procedure of packaging your own software using GNU autotools (autoconf and automake). Finally packaging and distribution of your softwares using cmake and cpack utilities are discussed. Bonus is writing and using your own man pages. (Tools used are make, autoconf, automake, cmake, cpack)

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

Lec06 Versioning Systems git-I


This session gives an overview of different models of versioning systems. Local version control systems (SCCS, RCS). Centralized version control systems (CVS, SVN). Distributed version control systems (git, bitkeeper, darcs, mercurial). Downloading and installing git. Basic git workflow and its configuration. Initializing git repository, Adding, editing, deleting and renaming files, and viewing commit logs. Ignoring files in git and undoing changes.

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

Lec07 Versioning Systems git-II


This is a continuity of previous session and starts with the concept of git branches. Creating, renaming, deleting and comparing branches. Overview of merging branches. The concept of fast forward and real merge. Handling merge conflicts. Concept of remote repositories and creating one on bitbucket. Pushing a local repo to bitbucket. Cloning an existing repo from bitbucketemail:

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

Lec08 Exit Handlers and Resource Limits


This session describes as to how a C program starts and terminates. Normal vs abnormal termination. Registering exit handlers using atexit() and on_exit() functions. Querying process resource limits and changing them on the shell. Getting and setting process resource limits from within a C program using getrlimit() and setrlimit() functions

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

Lec09 Stack Behind the Curtain


This session describes how a process is laid out inside the memory and discuss some important logical addresses. It describes how the command line arguments and environment variables are laid out on the stack and their usage. A discussion on layout of overall process stack and how it grows and shrinks. Stack buffer overflow problem. Doing a non-local goto using longjmp() and setjmp()

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

Lec10 Heap Behind the Curtain


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