OS(22)
-
[OS Project] Chap10-1. Process - PCB and Context switch
ProcessA process is an instance of an application. Each process has its own independent execution context and resources, such as a virtual address space. Practical operating systems provide the execution context as a separate concept called a "thread". For simplicity, in this book we'll treat each process as having a single thread. Process control block The following process structure defines ..
2025.01.19 -
[OS Project] Chap9. Memory Allocation
Memory AllocationBefore implementing a memory allocator, let's define the memory regions to be managed by the allocator . = ALIGN(4); . += 128 * 1024; /* 128KB */ __stack_top = .; . = ALIGN(4096); __free_ram = .; . += 64 * 1024 * 1024; /* 64MB */ __free_ram_end = .;} This adds two new symbols, __free_ram and __free_ram_end. This defines a memory area after the stack space. ..
2025.01.18 -
[OS Project] Chap8. Exception
ExceptionException is a CPU feature that allows the kernel to handle various events, such as invalid memory access (aka. page faults), illegal instructions, and system calls. Exception is like a hardware-assisted try-catch mechanism in C++ or Java. Until CPU encounters the situation where kernel intervention is required, it continues to execute the program. The key difference from try-catch is ..
2025.01.17 -
[OS Project] Chap7. Kernel Panic
Kernel PanicA kernel panic occurs when the kernel encounters an unrecoverable error, similar to the concept of panic in Go or Rust. Have you ever seen a blue screen on Windows? Let's implement the same concept in our kernel to handle fatal errors. The following PANIC macro is the implementation of kernel panic#define PANIC(fmt, ...) \ do ..
2025.01.17 -
[OS Project] Chap6. C Standard Library
C Standard LibraryIn this chapter, let's implement basic types and memory operations, as well as string manipulation functions. In this book, for the purpose of learning, we'll create these from scratch instead of using C standard library. The concepts introduced in this chapter are very common in C programming, so ChatGPT would provide solid answers. If you struggle with implementation or under..
2025.01.17 -
[OS Project] Chap5. Hello World!
Say "hello" to SBI- SBI is an "API for OS". - To call the SBI to use its function, we use the ecall instruction#include "kernel.h"extern char __bss[], __bss_end[], __stack_top[];struct sbiret sbi_call(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5, long fid, long eid) { register long a0 __asm__("a0") = arg0; register long a1 __asm__("a1") = arg1; ..
2025.01.16 -
[OS Project] ์ด์์ฒด์ ๊ตฌํํ๊ธฐ ํ๋ก์ ํธ
2025. 01. 10 Friday ์ด์ Geek News์์ ์ฌ๋ฏธ์์ด ๋ณด์ด๋ ํ๋ก์ ํธ๋ฅผ ์ฐพ๊ฒ ๋์๋ค.! ๐ฉ๐ป์ ๋๋ก ๋ ์ฝ๋ฉ์ ํ ๊ฒ . . ์ง๋ ๊ฒจ์ธ ๋ฐฉํ๋ ํ์ฐฝ ์ฑ ๊ฐ๋ฐํ๋ ๊ทธ ์์ ์ด ๋ง์ง๋ง์ธ ๊ฒ ๊ฐ๊ฑฐ๋ฑ์ ^^.. ...๐ฅ๋ฌด์ธ๊ฐ ๋ง๋ค๊ณ ์ถ์๊ฒ ์์ด์,ํ๋ฐ๋ฐ ๋ฐค์ ๊ฐ๋ฐํ๋ ๋๊ฐ ๊ทธ๋ฆฝ๊ธฐ๋ ํ๊ณ ,, ์์ฆ์ ํ๊ณ ์ถ์ ์ผ๋ณด๋ค ํด์ผํ๋ ์ผ์ ๋ ๋ง์ด ํ๊ฒ ๋๋ ๊ฒ ๊ฐ๋ค์ .. .·โ(โ_โ)โ·. https://operating-system-in-1000-lines.vercel.app/en/ Intro | OS in 1,000 Lines operating-system-in-1000-lines.vercel.app์ธ์์๋ ๋๋จํ ๊ฐ๋ฐ์๊ฐ ๋๋ฌด๋๋ฌด๋ง์ผ์ - ..
2025.01.10 -
[FreeBSD] Kernel Organization
3.1 Kernel OrganizationThe FreeBSD kernel can be viewed as a service provider to user processes. Processes usually access these services through system calls. Some services, such as process scheduling and memory management, are implemented as processes that execute in kernel mode or as routines that execute periodically within the kernel.In this chapter, we describe how kernel services are provi..
2024.07.09 -
[FreeBSD] Network Layer Protocols, TCP/UDP and Bootstrapping
2.13 Network-Layer ProtocolsMost of the communication domains supported by the socket IPC mechanism provide access to network protocols. These protocols are implemented as a separate software layer logically below the socket software in the kernel. The kernel provides many ancillary services, such as buffer management, message routing, standardized interfaces to the protocols, and interfaces to ..
2024.07.06 -
[FreeBSD] Interprocess Communication
2.12 Interprocess CommunicationInterprocess communication in FreeBSD is organized in communication domains. The most important domains currently supported include the local domain, for communication between processes executing on the same machine; the IPv4 domain, for communication between processes using the TCP/IP protocol suite (version 4); and the IPv6 domain, which is the newest version of ..
2024.06.29