The following snippet of pseudo code for the producer consum…
The following snippet of pseudo code for the producer consumer problem using semaphores has a logical error. Identify the location of the error, explain what can go wrong, and suggest a fix to eliminate the error. (Hint: you can assume that all wait and post calls would be successful and not return an error code). semaphore m(1) // initialize counter to 1 semaphore s(0); // initialize counter to 0 Producer ============= sem_wait(&m) while (buffer full) { sem_post(&m); sem_wait(&s); } // insert item into the buffer sem_post(&s); sem_post(&m); Consumer ============== sem_wait(&m); while (buffer empty) { sem_post(&m); sem_wait(&s); } // remove an item from the buffer sem_post(&s); sem_post(&m);
Read DetailsWrite pseudocode that creates a child process, switches the…
Write pseudocode that creates a child process, switches the child’s standard output (1) and standard error (2), and lets the child process execute a program whose name is provided as a command line argument. As an example, assume that helloworld binary’s main function is implemented as follows: int main(int argc, char **argv) { write(1,”HELLO”,6); write(2,”WORLD”,6); return 0; } Let’s assume that the binary of the code you will implement is called changingWorlds would be called as $ ./changingWorlds helloworld and after this the child process that will execute helloworld writes “HELLO” to file that was accessible through descriptor 2 in the parent process and writes “WORLD” to the file accessible through descriptor 1 in the parent process.
Read DetailsYou have discovered a gene (Figure 7-3A) that is alternati…
You have discovered a gene (Figure 7-3A) that is alternatively spliced to produce several forms of mRNA in various cell types, three of which are shown in Figure 7-3B. The lines connecting the exons that are included in the mRNA indicate the splicing. From your experiments, you know that protein translation begins in exon 1. For all forms of the mRNA, the encoded protein sequence is the same in the regions of the mRNA that correspond to exons 1 and 10. Exons 2 and 3 are alternative exons used in different mRNA, as are exons 7 and 8. Which of the following statements about exons 2 and 3 is the most accurate? Figure 7-3
Read DetailsBonus Question worth 4-points: During class, we discussed be…
Bonus Question worth 4-points: During class, we discussed beginning inventory and purchases. We discussed that at the end of the period, cost of goods available for sale would be included in one of two places (accounts) in the financial statements. What were the two places/accounts that we discussed.
Read Details