forward-jt

@forward-jt

Joined on Apr 18, 2020

  • Problem 1 static void run(char *c, int t) { char *redir_stdin = NULL, *redir_stdout = NULL; int pipefds[2] = {0, 0}, outfd = 0; char *v[99] = {0}; char **u = &v[98]; /* end of words */ for (;;) { c--; if (is_delim(*c)) /* if NULL (start of string) or pipe: break */
     Like  Bookmark
  • 資料來源:linux 内核抢占那些事 何謂搶佔 (preemptive)? 當一個新的行程進入到 running state 的時候,核心的排程器會去檢查它的優先權,如果該行程的優先權比目前正在執行的行程還高的話,核心便會觸發搶佔,使得正在執行的行程被打斷,而擁有更高優先權的行程則會開始執行。 其實早期的 Linux 核心是不支援搶佔的,但是這樣會引發兩個問題: 在 v2.6 版的核心之前,當一個行程從使用者模式進入核心模式後,其他的行程只有等到他退出核心模式才有機會得到執行權,這樣就會有延遲的問題。 若一個低優先權的行程在執行 critical section 時執行被打斷,這會使得同樣需要進到該 critical section 的高優先權行程被迫暫停,這可能會造成優先權反轉。
     Like  Bookmark
  • contributed by < RZHuangjeff > Problem set Problem 2 Description This is a program that helps to handle coroutines of a process. With coroutine, a program can switch to other routine while the current executing routine is waiting for certain conditions happend, rather than blocks entire program. To be able to resume the execution point of former routine, a GCC extension called Labels as Values performs the key role, since it allows the address of a label being saved and jump (goto) to it later, via saved address. The typical use case of coroutine is to maintain I/O operations between different input sources and ouput destinations. Just like the example shown in the quiz, which handles I/O operations between standard I/O and a socket, those operations are executed simultaneously, which means that block waiting on standard input will not cause reading from socket being blocked. For the example shown in quiz, a wait on a condition is performed by macro cr_wait, once the condition that it waits for has not happened yet, this macro will return from the current function after address of the checkpoint, a unique label generated automaticaly, is saved. While that function is invoked later, macro cr_begin will realize that a checkpoint was saved and will jump to that checkpoint to resume execution. By wrapping several routines that should be executed simultaneously in a loop, next routine will be invoked while previous one is waiting.
     Like  Bookmark
  • contributed by < RZHuangJeff > Problem set Problem 1 Structures threadtask_t typedef struct __threadtask {
     Like  Bookmark
  • contributed by < RZHuangJeff > Environment Setup The environment is set up to reliable for running our experiment. The linux-headers package is installed by running following command: $ sudo apt install linux-headers-`uname -r` This package provides header files that defines linux kernal APIs. And to minimize the influence from scheduler and other processes while running experiments, two of eight CPU cores on my computer is isolated by setting up boot argument isolcpus, following are boot arguments of my system:
     Like  Bookmark
  • contributed by < RZHuangJeff > Problem set Problem 1 Structure Description #define MAX_STR_LEN_BITS (54) #define MAX_STR_LEN ((1UL << MAX_STR_LEN_BITS) - 1) #define LARGE_STRING_LEN 256
     Like  Bookmark
  • contributed by < RZHunagJeff > Problem set :::warning See What is the difference between a problem and a question? Problem usually means the major issue that leads to the need for a study. :notes: jserv :::
     Like  Bookmark
  • contributed by < RZHunagJeff > Question With a singly linked list defined as follows: typedef struct __node { int value; struct __node *next; } node_t;
     Like  Bookmark
  • contributed by < RZHuangJeff > Environment $ uname -a Linux vostro-5471 5.8.0-44-generic #50-Ubuntu SMP Tue Feb 9 06:29:41 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux $ gcc --version | head -1 gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0 Goal of Homework
     Like  Bookmark
  • Observation Price chart 說明:當時在網路上看到原油的期貨價格逐漸下跌還跌至負數,許多網路媒體都說這是史上難得一見的事情,我們就覺得原油應該是人類的必需品,價格不應 該會下跌,我們觀察到這個現象後,就對原油價格為什麼會下跌產生疑問,並想深入研究。 Hypothesis Would the isolation inside the United State caused this thing happen? And there was ran out of space for unsold crude oil. 我們觀察到價格開始下跌的時間是3月初,應該與美國封城的政策,使人們對原油的需求減少有關,然而美國封城的日期為3月19日,與日期3月初的日期對不起來,所以3月初的時候應該有另一個因子,然後我們查到3月初的時候opec與俄國的減產協議破產,打算增產並對主客戶降價,所以我們假設是opec減產協議造成了3月上旬的價格下降,而三月下旬才是美國封城所造成的原因。
     Like  Bookmark