Hello /prog/. Tomorrow, I have an exam about Operating Systems. I just noticed that apparently (although it has never been subject of the lecture), there is always one task about low level C programming, concerning semaphores, in the exam. I have experience in C++ and Java, but I've never done anything as close to the hardware as is required.
Is there any online book or something similar that can teach me low level C in one day?
Example solution for a task of an exam held in 2003:
int main(argc,argv) {
pid_t pid;
int pipefd[2];
int pipebackfd[2];
int r=-1;
char str[100]="Test";
int i;
pipe(pipefd);
pipe(pipebackfd);
if (fork()!=0) {
if (fork()!=0) {
close(1);
dup (pipefd[1]);
close(pipefd[0]);
get_data();
// wait(NULL);
} else {
close(0);
dup (pipebackfd[0]);
close(pipebackfd[1]);
while(r==-1) {
r=get(str);
}
printf("Layer3:str=%s\n",str);
}
}
else {
close(0);
dup (pipefd[0],0);
close(pipefd[1]);
close(1);
dup (pipebackfd[1]);
close(pipebackfd[0]);
fflush(stdout);
while(r==-1){
r=get(str);
}
addcrc(str);
}
return 0;
}
When I had an ``exam about Operating Systems', there was some unindented code on it, not unlike in >>1's post. Since I already had like 70 points out of the maximum 60, I wrote that I refuse to work with malformed code. Good times.
This isn't low level, you're using an operating system.
Name:
Anonymous2010-09-08 7:17
I just noticed that apparently (although it has never been subject of the lecture)
Sure thing, buddy. Instead of straight out lying, like this, just come clean and ask us to do your homework / studying for you.
Name:
Anonymous2010-09-08 8:13
>>1
Easy: do your exam as you have to, but don't stop on exams. Constantly learn and get new skills by facing interesting problems. And when you find something interesting try to understand (at least superficially) how it works.
Name:
Anonymous2010-09-08 10:23
>>1
just out of curiosity, has your professor ever mentioned the book K&R to you?
You'd have thought reading SICP would have thought him that code should be readable, and thus it should be indented in languages where code is usually indented.
progrider@こなた:~ echo "You'd have thought reading SICP would have thought him that code should be readable, and thus it should be indented in languages where code is usually indented." | sed -e 's/thought/taught//'
sed: -e expression #1, char 18: unknown option to `s'
Uh-oh!
Name:
Anonymous2010-09-08 16:06
why are operating system classes so obsessed with c and unix?