REN

Ph.D. in Computer Science at Rutgers University

Archives

  • Programming Language
    • C/C++
    • Java
    • Python
  • Computer Architecture
    • General
    • x86
    • ARM
    • GPU
  • Operating System
    • General
    • Bash Shell
    • Unix/Linux
  • Computer Security
    • System Security
    • Software Security
  • Compiler
    • Compiler Front-End
  • Computer Network
  • Algorithm
    • Data Structure in C
    • Algorithm in C
  • Database
  • Web

Blogs Preview

Integral and Float type in C

In this article, I'll make a overview on integral and float type in C and how float type formed.

Sign Extension in C

In this article, I'll take two examples on how sign extension occurs when doing type casting.

Three kinds of Char array in C

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.

Talking about C pointer (1) - Basic Concept on C pointer

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.

Talking about C pointer (2) - Pointer to array, Array of pointer and Two-level pointer

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.

Talking about C pointer (3) - Dynamic memory allocation and Function Parameter passing

In this article, I'll discuss some tricky topics relies on C pointers such as dynamic memory allocation, function argument passing.

Talking about C pointer (4) - Pointer of Structure, Shallow copy vs. Deep copy

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'.

Talking about C pointer (5) - Void Pointer and Generic Programming in C

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.

Talking about C pointer (6) - Function Pointer and Polymorphism in C

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.

Why We Need two's complement

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.

Memory Hierarchy - Cache

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.

Memory Hierarchy - RAM

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.

Memory Hierarchy - Disk

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

Pipleline and superscalar are two methods to exploit Instruction-Level Parallelism. This artcile will introduce concepts and discuss implementation on pipeline and superscalar.

Speculation Execution

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.

Out-of-Order Execution

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.

Instruction Dynamic Scheduling

Dynamic Scheduling are typically done by compiler. This article will discuss about hardware implementation on instruction dynamic schduling.

Basic Overview on x86 Architecture

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 with register EBP and ESP in x86

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.

Subroutine Call with register RBP and RSP in x64

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 in x86

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.

Paging in x86 and x64

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.

Baic Overview on Operating System

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.

How an Operating System is booted

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.

Processes and Threads

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.

Task Synchronization

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

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.

I/O

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

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.

Bash Basic

This post introduces the very foundamental background of Bash Shell and some very common command in Linux and Unix.

Environment and Variables

This post discusses about Environment of Bash. How to use variables and array.

Control Flows

This post talks about control flows of Bash.

Functions

This post foucus on how to use functions in bash.

String and Regular Expression

This post foucus on the use of string and regular expression in Bash.

Sed

This post foucus on the use of sed in Bash.

Awk

This post foucus on the use of awk in Bash.

Segmentation and Paging in Linux

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.

Process and Thread in Linux

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.

A Dual-Level Thread Library Implementation in Linux

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.

Unix/Linux creating process trick - fork(), execv()

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 Attack

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.

Fork Bomb

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 List

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

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

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.

String

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

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

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.