Data Structure in C
Algorithm in C
In this article, I'll make a overview on integral and float type in C and how float type formed.
In this article, I'll take two examples on how sign extension occurs when doing type casting.
Char arrays are very often used in C language, while new C-learners may be confused by how to declare and use a char array. In this article, I'll show the difference between three types of char array in C.
This is the first one of 'Talking about C pointer' series. In this article, I'll discuss some basic concept on pointers including what are pointers, how to use pointers. In addition. multi-level pointers and pointers with 'const' will also covered in this article.
This is the second one of 'Talking about C pointer' series. In this article, I'll discuss the difference between array of pointers, pointers of array and two-level pointer.
In this article, I'll discuss some tricky topics relies on C pointers such as dynamic memory allocation, function argument passing.
This is the fourth one of 'Talking about C pointer' series. In this article, I'll discuss pointer of structure, shallow copy vs. deep copy and avoiding memory leakage when using pointer of structure. In addition, I'll show an example in Linux kernel source code on how to use pointer to get the 'container of an element'.
This is an advanced topic of 'Talking about C pointer' series. This post will talk on a special pointer - void pointer, and how could we achieve generic programming in C language.
This is the last topic of 'Talking about C pointer' series. This post will talk on an advanced pointer - function pointer and how could we achieve polymorphism and simple Object-Oriented Programming in C language.
In most computer architecure class, you'll know two's complement comes from the reversal of all bits in true form and then plus 1. In this ariticle, I'll show why we need it, and how it helps in computer architecture.
Cache plays an important role in memory hierachy. Accessing Cache is much more faster than accessing main memory. In this article, you'll see what is a cache, why we need cache, category of cache in usage and three kinds of cache in design. In addition, I'll stress out the whole process how the CPU get data from cache or main memory.
RAM stores everything the system need. Compared to another article about memory system in OS directory, this article will discuss on RAM in the aspect of hardware system.
Disk serves as a second storage which could store data when system is powered off compared to transient storages like Cache and RAM. This post mainly introduces hardware structure of Hard Disk and recently advent Solid-State Drive and I/O in hardware.
Pipleline and superscalar are two methods to exploit Instruction-Level Parallelism. This artcile will introduce concepts and discuss implementation on pipeline and superscalar.
In a pipeline architecture, a branch instruction will delay the pipeline because we don't know which instruction to execute next until we execute the current branch instruction. This article will discuss on concepts and advanced topics about speculation and branch prediction.
In previous article, we learnt branch prediciton increases ILP on branch instructions. By eliminating anti-dependency and output-dependency on data, out-of-order execution will increase ILP on more instructions. We will talk about details on out-of-order execution.
Dynamic Scheduling are typically done by compiler. This article will discuss about hardware implementation on instruction dynamic schduling.
x86 is one of the most popular architecure in desktop micro-processor. In this article, I'll make a brief overview on x86 architecture, registers in x86, x86 addressing mode and x86 micro-architecture related.
Subroutine call in x86 architecture has everything to do with two registers: EBP and ESP. I'll discuss what happens in the call stack and the change in EBP and ESP when a subroutine is invoked.
In x64, there're some differences in subroutine call compared to x86; not just extend everything to 64 bit. In this article, I'm gonna show the layout of stack frame in x64.
Segmentation is a mechanism in x86 for memory management. In this article, I'll cover why x86 need segmentation and more details on segmentation in x86.
In last article we've already discussed the segmentation mechanism in x86 memory management. This article will cover some detailed explanation on paging in x86 memory management, including PAE and PSE-36, and what's new in x64.
Operating System, used by us everyday, is the "lowest" level for most peoples even including programmers, which hiding machine details and presenting us a highly abstraction of a cold machine executing bit streams. In this article, I'll cover the basic concepts of operating system, such as how OS originated, different kinds of OSes, how a modern OS formed and OS kernel.
During my studying and research in operating systems, few textbooks give a rather detailed description on how an operating system is booted. In this article, I'll talk about how an operating system is booted based on x86 machine and Linux.
After equipped with how the kernel is booted in the previous article, we're gonna see two of the most important concepts in operating systems - Processes and Threads.
In the previous post, we have learned processes and threads. As we know, modern OSes have the responsibility to schedule different processes and threads, and there're also some dependencies between them. Thus, we need some mechanisms to synchronize these tasks. In this blog, I'll introduce these synchonization mechanisms.
Memory System who holds everything - data, instructions we need to let the machine run correctly plays an important role in an operating system. In this article, I'll cover some basic knowledge in memory system and memory management in the view of operating system.
Previous post talks about memory system. RAM is transient, which means data stored in RAM will lose once the computer is powered off. However Disk is a permanent storage media. This post will talk on I/O performance in OS level.
File system serves as an abstract layer between the low level I/O operation and user interace. This article will talk about some basic concept and principles on file system.
This post introduces the very foundamental background of Bash Shell and some very common command in Linux and Unix.
This post discusses about Environment of Bash. How to use variables and array.
This post talks about control flows of Bash.
This post foucus on how to use functions in bash.
This post foucus on the use of string and regular expression in Bash.
This post foucus on the use of sed in Bash.
This post foucus on the use of awk in Bash.
In Computer Architecture directory, I've already posted two blogs talking about segmentation and paging in hardware in x86 architecture. In this post, I'll discuss how segmentation and paging are implemented in Linux kernel.
This post will introduce the process and thread implementation in Linux Kernel. Including basic data structures analysis, process switch. In addition, I'll also cover process tree in Linux, orphan process, zombie process and daemon process.
This post will discuss an implementation of a hybrid thread library providing both user-level thread and kernel-level thread, including corresponding mutex lock, condition variable.
This post will discuss on the trick of creating process in Unix family OSes. I'll cover detailed stuffs on process related system calls: clone(), fork(), execv() and wait().
Buffer overflow is a classic attacking method using input buffer overwriting the memory contents in programs wrote in non-memory safe language such as C and C++. In this article, I'll stress out how to exploit buffer overflow and design attack payload on x86 architecture.
As we Know, the Unix family uses fork() to create a process, and the "once-call, twice-return" mechanism sometimes makes it vulnerable especially in tens of millions of UNIX/Linux servers runs in 24/7. This post will talk about the basic idea of fork bomb and how could we detect it.
Linked Lists are pointer based data structure. Compared with Arrays, Linked Lists have several advantages such as dynamic length, no need to be physical consecutive. This article made a very detailed description on LinkedList operations in C Language.
Stack is a data structure which allows data in it come or go with a FILO (First In Last Out) sequence. Stack could either be implemented with arrays or linked lists. In this article, I'll use array to describe stack in C Language.
Queue is a data structure which allows data in it come or go with a FIFO (First In First Out) sequence. Queue could either be implemented with arrays or linked lists. In this article, I'll use array to describe queue in C Language.
Although the C language has char arrays and corresponding methods for them, it's vulnerable for some functions such as gets() and strcpy which could cause stack buffer overflow. We could encapsulate them and define our own strings in C language.
Binary Tree is a tree data structure in which each node has at most two children. I'll show the data structure of binary tree in C language and its corresponding operations such as pre-order, in-order and post-order traversal in this article.
Hash table is a data structure uses a hash function to compute an index into an array of buckets or slots, from which the desired value can be found.