Top 10 List of Week 06

Jonathan Nicholas --- Jakarta

Top 10 List of Week 06

  1. How to kill child of fork? (thread)
    If you’ve ever read programming memes, then you might’ve stumbled across a meme about “killing child with fork”. This article is the origin of that meme, and it actually is a great resource to understand that meme, and ofcourse understanding about fork in general. The answer to this question is kill(pid, SIGTERM);. I guess one of the ways to learn is getting curious from a meme!

  2. Reading 17: Concurrency (article)
    I know what concurrency is, but i don’t think i KNOW what concurrency is. This is the first time I’ve included an article from MIT, and I’m not surprised on how detailed the article is. There are two models of concurrent programming, shared memory and message passing. In a more modular component, there are threads and processes in a concurrent system. TLDR, concurrency is multiple computations running simultaneously, it is a necessary tool to have in modern software development and have to be implemented correctly to avoid problems such as race condition.

  3. What is the difference between concurrency and parallelism? (thread)
    Another topic closely related to concurrency is paralellism, yet they are different. This article is another stackoverflow thread, and it is perfect as it is one of the most asked questions and therefore have many and high quality answers. To explain concurrency, I’m quotiong Rob Pike, the creator of go, “just break up this long sequential task so that you can do something useful while you wait.”. I still haven’t fully understand the difference, but from what I’ve read, the difference is concurrency is a clever way of splitting tasks so when there is no synchronize needed, a single-core machine can multitask computations, whereas parralellism is when multiple operations run literally at the same time, as they are run on a multi-core processor.

  4. Concurrency is not Parallelism. Rob Pike at Waza 2012 (article/video)
    From the creator of the Go programming language, this is a must read/listen/watch link as it has video + article explanation + audio form of explaining concurrency and parralellism. This is a great complement to strengthen your understanding if you’re still confused from the previous number in this week’s currated list. Rob explains amazingly with visuals and I’ll try to explain it here. Task: let’s obsolete documentation, one by one. Concurrency: one worker burning multiple documentation. Pararellism: multiple workers burning multiple documentation.

  5. Difference between Process and Thread (article)
    Taking a more low level understanding of concurrency, threads and processes are what makes concurrency possible. I’ve actually explained this in my week2 compilation, but it’s great to learn more about it. “A thread is a single sequence stream within a process, sometimes called a lightweight process. Threads are used to improve applications using concurrency.” This geeksforgeeks article also has visualization in the form of pictures and a table of difference, which I love and highly recommend on reading to undestand more about these important concepts.

  6. Learn Makefiles (article)
    So the rest of this list will be me learning to understand this week’s assignment and demos, as it is very interesting and is one of the most important topics in OS. You know this article/tutorial will be good if it’s domain is named after what it’s purpose. If you attend this week’s class and quiz, you’ve been greeted by the make command. This article is jam-packed with command examples, and explains that makefiles basically help decide which parts of the program that needs to be recompiled and is used mostly with c/c++.

  7. How does wait(NULL) exactly work? (thread)
    Another important function to understand in this week’s demo is the wait(NULL) command. Sir has explained it, but I wanted to make sure that I have the full understanding of the command. This thread’s short and concise, as it has only 1 answer, but with a respectable amount of upvotes. wait(NULL) will block parent’s process until any of it’s children has finished. From this thread I also familiarized myself with zombie process, where it happens when a child terminates before the wait(NULL) statement is reached. Conversely, if a parent doesn’t wait for it’s child and terminates, it’s child becomes an orphan and it’s ppid() will become 713.

  8. Understanding the need for fflush() and problems associated with it (thread)
    Next up is the fflush(NULL). In short, flush flushes a stream, but I’m a little bit confused with the NULL argument. From this article, I learned fflush(NULL) flushes all open output streams. User torek also explains the problems that might occur, specifically if the flush command is used excessively. He also explains how flush works with fork and how fflush solves the problems associated with it. With fork, the buffers are in the user space, the same as the childs. With fflush, the buffer is flushed out before the fork.

  9. I do not understand how execlp() works in Linux (thread)
    Yes thread master, me too. The next command on my to do list of commands to understand is execlp. Stackoverflow is the way to go when you want to understand quick, yet deeply on computer science topics. int execlp(const char *file, const char *arg, ...); the first argument to the function is the path name of the executable file, and the rest of the arguments of execlp is the arguments to be executed. The second argument is also a const char and it’s the string we want to appear as the first argument. By convention both of these arguments should be the same, normally. The rest of the arguments must be ended with a NULL argument. Example execlp("ls", "ls", (char *)NULL); is to execute the ls command.

  10. fork(2) — Linux manual page
    After all of these important concepts, I felt it’s appropriate to wrap it all up with, what I think, is the sandwich of the above topics and commands, the fork command.This article is the holy armament of linux, from what I’ve read, and is very detailed. The fork() commmand creates a child process, a new process by duplicating the calling process, the parent. They both run in seperate memory process, yet the same user space as seen with the problem that fflush() solves (clearing the buffer before forking). From the demo, I also learned that the child has it’s own process id (PID) with the ppid of it’s parent.


© 2021-2021 --- Jonathan Nicholas --- File Revision: 1.0.0---01-Mar-2021.