Skip to main content

· 10 min read

Shell Scriping:

  • The different variants of exec do slightly different things. Some take a variable number of string arguments. Others take a list of strings. Still others let you specify the environment that the process runs with. This particular variant expects a program name and an array (also called a vector, hence the ‘v’) of string arguments (the first one has to be the program name). The ‘p’ means that instead of providing the full file path of the program to run, we’re going to give its name, and let the operating system search for the program in the path.
  • Once fork() returns, we actually have two processes running concurrently. The child process will take the first if condition (where pid == 0).
  • We use waitpid() to wait for the process’s state to change. Unfortunately, waitpid() has a lot of options (like exec()). Processes can change state in lots of ways, and not all of them mean that the process has ended. A process can either exit (normally, or with an error code), or it can be killed by a signal. So, we use the macros provided with waitpid() to wait until either the processes are exited or killed. Then, the function finally returns a 1, as a signal to the calling function that we should prompt for input again.
  • build-in commands are like CD and Exit. If you want to change directory, you need to use the function chdir(), the thing is, the current directory is a property of a process. So if you wrote a program called cd that changed directory, it would just change its own current directory, and then terminate. Its parent process's current directory would be unchanged. Same thing with exit.
  • A forward declaration is when you declare (but don’t define) something, so that you can use its name before you define it.

Problem Set:

First Set

  1. Q: How is a system call different from a function call?
    • A System Call provides abstractions to user program and managing computer’s hardware resources; its functionality is generally defined by POSIX for UNIX/ or Windows Standards.
    • A system call involves trapping into Kernel, which executes an interuption to Kernel. A Function Call generally refers to a call to a piece of code in the user space, thought, there might be system calls involved in a function call in specific cases such as fopen().
    • System call involves a mode switch from user to kernel.
    • Functionality: system calls are set by OS developer, function call can be arbitarily written by the programmer

· 7 min read
  • This note-blog basically covers readings of chapter 2
  • waitpid(pid_t pid, int *status, int options)

Processes-2.1

  • Pseudoparallelism: only one process is running at a certain instance, in a course of 1 second, cpu works on several of them, giving the illusion of parallelism.
  • Multiprocessor Systems : two or more CPUs sharing the same physical memory. Keeping track of multiple/parallel activities is hard for people to do. => OS designers evolved a conceptual model (sequential processes)

· 2 min read
  • Describes the different ways user / stakeholders interact with the system
  • Analysis technique to describe in a formal way how a computer system should work. It lists a sequence of actions that yields a result that is of value to an actor.
  • For each of ellipse we have, there is an use-case template associated with it. image

· 7 min read

When I joined Business Process and Information Technology Department of Baidu.inc, I was assigned to a team which was responsible for a development of the Internet giant's ERP system. During my service at the company, I was amazed by the amount of efficiency improvement owning to process management software. Meanwhile, there exists such a similarity between Redux, which is a functional programming based framework suggested by Facebook, and ERP process management.

Redux and Functional Programming

What is Redux?

Redux is a Javascript library that is based on concept of Flux, which provides a great framework to maintain state management (it plays a crucial role combining with React.js which renders JSX based on state-change). Following diagram illustrates a simple paradigm. image

· 2 min read

I have almost done my summer internship at Baidu.inc. As a Chinese person, it has been a dream to work for Baidu, since it is not only the Chinese Google, it is also the Chinese Reddit (Baidu Tieba) and Quara (Baidu Zhidao), and Baidu has Andrew Ng who is a rockstar in Artificial Intelligence working as a Chief Scientist. I did get a few decent offers from tech firms in Canada, but eventually I decided to work in Beijing just to experience the Internet world and see how it is going in China.

Memories

Me and My Tech Lead

My tech lead is an admirable person in terms of personalities and technologies. He used to work for Atlanssian™, the producer of Jira and SourceTree. He has great sense of Agile Development.

Robin Li

CEO of Baidu speaks at summer party

· 10 min read

The AI agent has two main methods of coming up with a good move. When processing time and RAM space is sufficient, it utilizes a Alpha Beta Pruning Search Tree algorithm to search the seed amount that it will have after few rounds of moves for all current legal moves; while running time and RAM space is limited or board states are numerous to be processed, it will filter and compare the pre-defined heuristics, evaluate the board state at a level and sum up all heuristic factors to find the best move. A search tree algorithm is more accurate than Heuristic method because it inspects all cases in the following “n” rounds instead of narrowing itself down to one certain state. Since the given constrains give enough space and running time for the AI agent to go for at least a depth of 6 rounds for alpha pruning search, and this Has game has a maximum of 32 pits for one side to be counted for each turn, it will use Alpha Beta Pruning mainly. image

· 4 min read
  • Denoted by []
  • [ae] -> matches an 'a' and an 'e', not multiple:
    • i.e. gr[ae]y will match grey and gray
  • [a-z] -> hyphen specifies a range of characters:
    • i.e. [0-9] matches a single digit
    • i.e.2 [a-f] matches a char in a-f
  • [a-z0-9A-F] -> groups of hyphen specifies a group of ranges
  • qx -> caret after openning bracket negates the character class:
    • i.e. qX matches qu in question
    • i.e. must write it at the front of a class/set

· 9 min read

Metanautix now has Personal Quest online where individual users can download and do analytics on desktop. I have been working on a new systematic way to learn music theory and do musical analysis with mathematical matrix and vectors, and Quest is a critical tool in query on large dataset such as a pool of thousands of song scores. In this article, I will talk about my methodology in detail.

An overview for my system will be: image