Skip to content
Ernest Baffour, home

Ernest Nana BaffourAccra, Ghana

Ernest Nana Baffour, Systems Software Engineer

I write low-level software in C: a text editor, a shell and a memory allocator, all built from scratch.

CS student at the University of Ghana. Open to interesting engineering roles.

Ernest Nana Baffour, smiling, in front of tall green grass

About

I'm a Computer Science student at the University of Ghana, and I write systems software in C.

I like to know how things work under the hood, so I build them myself instead of reaching for a library. So far that's a text editor that draws straight to the terminal, a shell that runs its own processes, and a memory allocator that manages the heap block by block.

Building these taught me more about operating systems, memory and performance than any lecture did. I like low-level work where correctness and speed matter, and I'm always looking for the next thing to take apart.

When I'm not coding, I'm doing LeetCode problems, playing basketball or playing Call of Duty Mobile.

Based in
Accra, Ghana
Studying
BSc Computer Science, University of Ghana

Projects

  1. Text Editor

    A text editor that runs in the terminal, written in C. It uses nothing beyond the C standard library and POSIX.

    • Puts the terminal into raw mode with termios and draws with VT100 escape codes
    • Stores text in a gap buffer, so inserting and deleting is cheap
    • Cursor movement, scrolling, open and save, and incremental search
    • Syntax highlighting for C

    C · POSIX · termios · VT100/ANSI escape codes · Make

    Text Editor on GitHub: baffourz/text-editor

    gap buffer

    click, then type

    return 0;gap

    Typing fills the gap. Moving the cursor moves the gap.

  2. Unix Shell

    A Unix shell written in C. It reads commands, starts programs, and handles pipes and redirection.

    • Parses commands, arguments and quoted strings
    • Starts programs with fork, execvp and waitpid
    • Redirection (<, >, >>) and pipes (|), using dup2 and pipe
    • Built-in commands: cd, pwd, exit, echo
    • Ctrl+C stops the running program, not the shell

    C · POSIX system calls · Linux · Make

    Unix Shell on GitHub: baffourz/shell
  3. Memory Allocator

    A replacement for malloc, free, calloc and realloc, built on sbrk and mmap. Any program can use it as a drop-in.

    • Segregated free lists, with block splitting and merging to limit fragmentation
    • Large allocations go straight to mmap
    • Thread-safe, with one arena per thread so threads don't wait on a shared lock
    • Tested on real programs with LD_PRELOAD and checked with Valgrind

    C · sbrk/mmap · pthreads · Valgrind · GDB · Make

    Memory Allocator on GitHub: baffourz/allocator

    heap

    483224644832
    • header
    • in use
    • free

    malloc splits a free block. free merges it back with its neighbours.

    malloc(24) found the 48-byte free block and split it: 24 in use, 24 still free.

    free(p) released the 24-byte block. It merged with the free 32 beside it into one 56-byte block.

Skills

Languages
  • C
  • Python
  • Bash
Systems
  • Linux
  • POSIX APIs
  • Processes & signals
  • Memory management
  • File I/O
Tools
  • Git
  • GDB
  • Valgrind
  • Make
  • Vim
Fundamentals
  • Data structures & algorithms (LeetCode)
  • Operating systems concepts

Education

  • In progress

    BSc Computer Science

    University of Ghana

  • Certificate

    CS50: Introduction to Computer Science

    Harvard / edX

Contact

Open to interesting engineering roles.