bigrigg ([info]bigrigg) wrote,
@ 2005-05-07 09:24:00
Previous Entry  Add to memories!  Tell a Friend!  Next Entry
CS1550 Summer 2005
Introduction to Operating Systems



Page 1 of 3
<<[1] [2] [3] >>

(Post a new comment)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-07 01:54 pm UTC (link)
Post anonymously, but use your email address for the subject field. This makes any required follow-up easier.

(Reply to this)

cms78@pitt.edu
(Anonymous)
2005-05-20 03:12 pm UTC (link)
OK... I've got the two c files in my unix "private" directory and I've successfully compiled them into "myshell". But I can't get the program to execute. When I type "myshell" at the prompt it just tells me "command not found." Having a major "duh" moment here, plz help :)

(Reply to this)

cms78@pitt.edu
(Anonymous)
2005-05-20 03:21 pm UTC (link)
NM I figured it out. That directory isn't in the PATH, so I have to type "./myshell"

(Reply to this)

jon_conley@comcast.net
(Anonymous)
2005-05-22 03:56 pm UTC (link)
I am looking for a good way for a parent process to communicate with its child processes (in assignment 1). I know that the parent needs to find out the status of its children (Running, Terminated, etc.) but I'm not sure how to go about it. Parent can intercept SIGCHLD signals which will tell it if a child was terminated, but doesn't appear to be able to find out which child. Popen() will create a pipe between the parent and child, but it appears to only be able to read from the child's stdin or write to its stdout. Or am I barking up the wrong tree altogether?

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-22 05:16 pm UTC (link)

You say you want to communicate with the child. I assume you think that is how to "ask" it if it is still alive. Perhaps instead you want to ask the operating system. Look up waitpid. There is a version of it in the myshell.c code. Do a man on waitpid and look up how to ask the status of a process without hanging. If you can ask the status of processes based on their pid's, which is the value that you get back from fork. What kind of data structure are you going to use to keep track of the child processes that you spawn?

(Reply to this) (Parent)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-22 06:02 pm UTC (link)
As mentioned possible in the last lecture, we will combine the Tue and Thur recitation into one. The one recitation will be held on Tuesday evenings. The first combined recitation will be this Tuesday May 24th, where you will have your first quiz!

(Reply to this) (Thread)

bwheeler@pitt.edu
(Anonymous)
2005-05-23 03:04 am UTC (link)
Does this mean we will be dropping to only 1 day of office hours, since your Tuesday set of office hours are durring the same time as Tuesday's recitation class?

(Reply to this) (Parent)(Thread)

bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-23 03:44 am UTC
cms78@pitt.edu
(Anonymous)
2005-05-23 04:05 am UTC (link)
myshell seems to compile and runs under Cygwin (making my life a lot easier). Still I'll make sure it runs on "real" unix before submitting.

So... what does the -lfl compiler flag do? I could look through a zillion pages of man file, but I'm lazy. :)

(Reply to this) (Thread)

Re: cms78@pitt.edu
[info]bigrigg
2005-05-23 04:26 am UTC (link)
The -l flag is to link in a library. In this case it means to link in the lex library. While running "lex lex.c" will produce lex.yy.c, there are still some additional routines needed.

(Reply to this) (Parent)

boi1@pitt.edu
(Anonymous)
2005-05-25 12:44 am UTC (link)
After talking to a few people in class today, it seems that most of us think HW1 was graded a little to strictly, to the point of splitting hairs. For example: in question 14 "a trap is generated by the program, when it needs something from the OS" illicited the comment "Not Necesserily. You can have traps without the program asking for them". I recognize the need of precise answers, but the point of the question seemed to be to defrinciate between a trap as a top down occurence, and an interupt as a bottom up occurence.

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-25 04:28 pm UTC (link)
Your comment has been noted.

(Reply to this) (Parent)

sarpeshk@hotmail.com
(Anonymous)
2005-05-28 05:01 pm UTC (link)
In class the other day, you mentioned that a linked list would be excessive or unnecessary for tracking our jobs, and that we should just use an array. The question I have is, how big an array do we really need? Or, more accurately, how many jobs can we expect to be tracking at any given moment? I don't want a small array to destroy my grade when the grader tests my shell by running a trillion background jobs before using the jobs command.

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-28 05:15 pm UTC (link)
I wouldn't expect more than 20 jobs. But if you make
an array that supports 100 jobs that should be reasonable.
Make it 100 jobs maximum.

(Reply to this) (Parent)

bwheeler@pitt.edu
(Anonymous)
2005-05-28 06:59 pm UTC (link)
On the programming assignment is says that jobs takes no arguments, timex takes an application for an argument, and all the other commands we are to implement take a job id number as an argument. However if wait just "holds until all jobs are done" like mentioned on the assignment page why does it need a job id number passed to it?

(Reply to this) (Thread)

bwheeler@pitt.edu
(Anonymous)
2005-05-28 08:46 pm UTC (link)
I am also confused on what you want the notify command to do. Is it suppost to block until the job sent through its argument is done? All of my internet searches are producing mixed results.

(Reply to this) (Parent)(Thread)

bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-28 09:34 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-28 09:27 pm UTC
bwheeler@pitt.edu - (Anonymous), 2005-05-28 10:14 pm UTC
bwheeler@pitt.edu - (Anonymous), 2005-05-28 10:16 pm UTC
bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-29 02:57 pm UTC (link)
Sunday May 29th, 11AM. I will be gone for the rest of the day unable to respond to your emails. If you are stuck, leave a question here and perhaps a fellow classmate can answer. For those who can answer a question, it will help your class participation.

(Reply to this)

jjc31@pitt.edu
(Anonymous)
2005-05-29 07:55 pm UTC (link)
Hello

I'm not sure what we need to do for most of these commands. I have jobs done but other than that .....??????
If someone can help point me in the right direction of what to do, it would be greatly appreciated.

Thanks

(Reply to this) (Thread)

bwheeler@pitt.edu
(Anonymous)
2005-05-29 08:10 pm UTC (link)
My wait command has similar functionallity to my jobs command. I don't see how some of the rest of the commands can be done asynchronously without signals though. Anyone have any ideas about that?

(Reply to this) (Parent)(Thread)

bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 03:48 am UTC
jon_conley@comcast.net
(Anonymous)
2005-05-29 10:55 pm UTC (link)
I am having a problem when I try to catch a signal. Everytime I uncomment the following code (in order to enable the sighandler) I get an error and myshell crashes:
sigset(SIGCHLD, sig_handler);

and here is the error I get right before it crashes:
input in flex scanner failed

Does anyone know what I am doing wrong? It seems like the signal handler doesn't play nice with lex or something.

(Reply to this) (Thread)

bwheeler@pitt.edu
(Anonymous)
2005-05-30 12:10 am UTC (link)
I am not sure what you are doing wrong, but I am getting the same message. I tried to run the shell locally on my computer's linux build to see if it was something specific with the solaris OS, but it crashed on my linux (Debian) build too giving the same error message "input in flex scanner failed".

I also tried changing the wait command in the handler to a waitpid and set it up to check all the child processes, but it still crashed when ever I forked a child process and did not make the parent wait until the child completed using the '&' argument.

Anyone else run into this or find a fix or way around using this?

(Reply to this) (Parent)(Thread)

jon_conley@comcast.net - (Anonymous), 2005-05-30 03:13 am UTC
jon_conley@comcast.net - (Anonymous), 2005-05-30 03:28 am UTC
jon_conley@comcast.net - (Anonymous), 2005-05-30 03:37 am UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 03:45 am UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 05:02 pm UTC
Re: bigrigg@cs.pitt.edu - (Anonymous), 2005-05-30 06:20 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 07:13 pm UTC
bcp7@pitt.edu - (Anonymous), 2005-05-30 09:08 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 10:28 pm UTC
jon_conley@comcast.net - (Anonymous), 2005-05-31 02:35 am UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-31 03:22 am UTC
sve2@pitt.edu - (Anonymous), 2005-05-31 04:54 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-31 06:20 pm UTC
sve2@pitt.edu - (Anonymous), 2005-05-31 07:51 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-31 08:09 pm UTC
kad28@cs.pitt.edu - (Anonymous), 2005-05-31 07:17 pm UTC
Re: kad28@cs.pitt.edu - [info]bigrigg, 2005-05-31 07:49 pm UTC
mak78@pitt.edu
(Anonymous)
2005-05-30 02:44 pm UTC (link)
Does the STOP command means to pause the job ?? in the assignment it says to cancel the job ?? can anyone explain.

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-30 04:33 pm UTC (link)
From the man page (man stop)... stop: stops the execution of a background job(s) by using its job_id. You can say to cancel the job, to stop it, to kill it. To make it no longer around. It does not mean pause. The job is gone.

(Reply to this) (Parent)(Thread)

bwheeler@pitt.edu - (Anonymous), 2005-05-30 05:19 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 06:13 pm UTC
boi1@pitt.edu
(Anonymous)
2005-05-30 05:22 pm UTC (link)
Am I missing something obvious?
I am trying to add a for loop in the internal command function, but it seems that gcc is having trouble with declearing an int (as rediculous as that sounds). I tried declearing an int in a separet line to see what happens, and I get the same thing (Code and errors below) any thoughts?

----------------Begin Code-----------
/*
* Check for internal commands
* Returns true if there is more to do, false otherwise
*/
int internal_command(char **args) {
if(strcmp(args[0], "exit") == 0) {
exit(0);
}
if(strcmp(args[0],"jobs") == 0){
printf("ID Name\n");
int j=0;
for(int i=0;i<procplace;i++) { printf("%d %s \n",proc[i].procid,proc[i].name); // printf("1\n"); } } return 0; } /* [ Wrote 269 lines ] (55) unixs1 $ gcc -o myshell myshell.c lex.yy.c -lfl myshell.c: In function `internal_command': myshell.c:142: parse error before `int' myshell.c:143: parse error before `int' myshell.c:143: `i' undeclared (first use in this function) myshell.c:143: (Each undeclared identifier is reported only once myshell.c:143: for each function it appears in.) myshell.c:143: parse error before `)' myshell.c: At top level: myshell.c:151: parse error before `return'

(Reply to this) (Thread)

Re: boi1@pitt.edu
(Anonymous)
2005-05-30 05:25 pm UTC (link)
---Second part (message got trancated---
if(strcmp(args[0],"jobs") == 0){
printf("ID Name\n");
int j=0;
for(int i=0;i<procplace;i++) { printf("%d %s \n",proc[i].procid,proc[i].name); // printf("1\n"); } } return 0; } /* [ Wrote 269 lines ] (55) unixs1 $ gcc -o myshell myshell.c lex.yy.c -lfl myshell.c: In function `internal_command': myshell.c:142: parse error before `int' myshell.c:143: parse error before `int' myshell.c:143: `i' undeclared (first use in this function) myshell.c:143: (Each undeclared identifier is reported only once myshell.c:143: for each function it appears in.) myshell.c:143: parse error before `)' myshell.c: At top level: myshell.c:151: parse error before `return'

(Reply to this) (Parent)(Thread)

Re: boi1@pitt.edu - (Anonymous), 2005-05-30 05:26 pm UTC
jjc31@pitt.edu - (Anonymous), 2005-05-30 05:33 pm UTC
Re: jjc31@pitt.edu - (Anonymous), 2005-05-30 05:49 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-30 06:14 pm UTC
sarpeshk@hotmail.com - (Anonymous), 2005-05-30 06:18 pm UTC
Re: jjc31@pitt.edu - (Anonymous), 2005-05-30 06:24 pm UTC
Re: jjc31@pitt.edu - (Anonymous), 2005-05-30 06:27 pm UTC
bwheeler@pitt.edu - (Anonymous), 2005-05-30 06:29 pm UTC
sarpeshk@hotmail.com
(Anonymous)
2005-05-31 12:03 am UTC (link)
Ok, I can't be the only one experiencing this...when I run ./myshell, I notice that any time I attempt to type backspace or delete at the prompt, it outputs an escape sequence instead of deleting the previous or following (or any) character. Is there any way to modify the shell to fix this annoying little behavior?

(Reply to this) (Thread)

Re: sarpeshk@hotmail.com
(Anonymous)
2005-05-31 12:47 am UTC (link)
Delete key works as Backspace key on mine!!

(Reply to this) (Parent)(Thread)

sarpeshk@hotmail.com - (Anonymous), 2005-05-31 01:12 am UTC
Re: sarpeshk@hotmail.com - (Anonymous), 2005-05-31 01:22 am UTC
sarpeshk@hotmail.com - (Anonymous), 2005-05-31 02:06 am UTC
Project due date
(Anonymous)
2005-05-31 12:39 am UTC (link)
Do we e-mail the project midnight tonight or midnight tuesday night?

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-31 01:18 am UTC (link)
Please use your email address as the subject. Midnight Tuesday as in a few hours after class. Turn in the hardcopy of the program in lecture.

(Reply to this) (Parent)

Boi1@pitt.edu
(Anonymous)
2005-05-31 02:11 am UTC (link)
I think it would be very helpful to see a short demo of sending and handling signals. There is a lot of stuff about it in the man pages and it's all rather confusing. Also, if anyone has any recommanded simple tutorials on this, that would be great.

(Reply to this)

kad28@pitt.edu
(Anonymous)
2005-05-31 02:13 am UTC (link)
why is it that my 'wait' command works only once!!! it only works the first time that i type it in. if i type it again after i spawned some processes in the background, i'll get to the -> prompt!!!(it wont work anymore, unless i exit the shell, and open it again)

I only used 'int result = wait(&status);' under the internal command.

any help would be appreciated

(Reply to this) (Thread)

Re: kad28@pitt.edu
(Anonymous)
2005-05-31 03:52 am UTC (link)
Are you sure that wait is blocking? If you lunched it in the beginning, and there are no processes, it wouldn't block, and would return to you. But after you have processes, wait need to block and wait for them to finish. If it doesn't, it might still be running in the background, and looking for backgraound processes...

(Reply to this) (Parent)(Thread)

Re: kad28@pitt.edu - (Anonymous), 2005-05-31 06:06 am UTC
kad28@pitt.edu
(Anonymous)
2005-05-31 03:12 am UTC (link)
should we delete the jobs that are terminated, completed, from our job's array? Should we constantly update the array??

or can we just leave each processes' ID in the array, eventhough those processes dont exist any more? and just list whatever is in the array, except NULL, when the user types in 'jobs'?

Thanks

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-31 03:21 am UTC (link)
You should probably delete the jobs from the array when they go away. There is no need to keep them around.

(Reply to this) (Parent)

boi1@pitt.edu
(Anonymous)
2005-05-31 01:15 pm UTC (link)
Ok, silly question:
How do I get the arguments out of the command line and into a useful format (IE put an argument into a variable)? the args array is decleared as char **args. what exactly does that mean?

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-05-31 01:23 pm UTC (link)
The line args=getline() will take the command line (what you type in at the -> prompt) and parse it into the individual words and store them into the args. The args is an array of strings. args[0] is the "command" and args[1] args[2] etc are the parameters given to the command.

(Reply to this) (Parent)(Thread)

Re: bigrigg@cs.pitt.edu - (Anonymous), 2005-05-31 01:40 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-31 01:47 pm UTC
Re: boi1@pitt.edu - (Anonymous), 2005-05-31 01:55 pm UTC
Re: boi1@pitt.edu - (Anonymous), 2005-05-31 03:41 pm UTC
Re: boi1@pitt.edu - (Anonymous), 2005-05-31 04:25 pm UTC
Re: boi1@pitt.edu - (Anonymous), 2005-05-31 06:10 pm UTC
bigrigg@cs.pitt.edu - [info]bigrigg, 2005-05-31 06:23 pm UTC
Re: bigrigg@cs.pitt.edu - (Anonymous), 2005-05-31 06:29 pm UTC
sve2@pitt.edu
(Anonymous)
2005-05-31 08:11 pm UTC (link)
Does it matter if my internal commands use process id's as the job id and not a simplified number?

(Reply to this) (Thread)

sarpeshk@hotmail.com
(Anonymous)
2005-06-01 02:40 am UTC (link)
I exclusively used the actual process ID's. I honestly don't think it matters, as long as the functions worked properly under whichever system you used.

(Reply to this) (Parent)

kad28@pitt.edu
(Anonymous)
2005-06-01 12:53 am UTC (link)
i know that i have to use SIGCONT signal to continue a job. but how do i turn a suspended background job into a active foreground job?? and vise versa?
is there acutally a difference in bg and fg coding?

and where should i be looking for the timex command? the man command doesnt help me much.

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-06-01 01:30 am UTC (link)
SIGCONT to continue (resume a background job) and SIGSTOP to suspend (pause a background job). To put a job into the foreground means that you block until that job is done. As for timex, look up gettimeofday().

(Reply to this) (Parent)

sarpeshk@hotmail.com - (Anonymous), 2005-06-01 02:39 am UTC
kad28@pitt.edu
(Anonymous)
2005-06-02 07:50 pm UTC (link)
should we make a report, printed hard copies, even if we were to demonstrate our late projects today(thursday after class)?

Thx

(Reply to this) (Thread)

bigrigg@cs.pitt.edu
[info]bigrigg
2005-06-02 08:41 pm UTC (link)
Not everyone will be able to demo this week. Late projects and the people we couldn't get to this week will demo next week.

(Reply to this) (Parent)

cms78@pitt.edu
(Anonymous)
2005-06-03 02:56 pm UTC (link)
Since we're in between projects, here's some bandwidth wastage for you all.
Programming Languange Inventor or Serial Killer (http://www.malevole.com/mv/misc/killerquiz/)

(Reply to this)

sarpeshk@hotmail.com
(Anonymous)
2005-06-08 06:30 pm UTC (link)
Pardon my ignorance of the ways of Pitt (this is my first semester here, having spent 3 of the past 5 at the University of Illinois), but I've been wondering, does Pitt provide any webspace or even file storage space anywhere for its students? I've noticed that the UNIXS space doesn't seem to be accessible other than SSH and SFTP. Illinois provided 100 MB of free space for College of Engineering students; I would've imagined at least CS students here might get something a little more substantial than the 10 MB no-HTTP UNIXS space.

(Reply to this) (Thread)

Re: sarpeshk@hotmail.com
(Anonymous)
2005-06-14 01:26 pm UTC (link)
Pitt sucks when it comes to giving space to its users. If you ftp to unixs.cis.pitt.edu, you can access your AFS space. You only get 5 megs, but if more space is required your instructor can request that you have more. If you want to put up a web page, go to the public folder and create a 'html' folder. Anything in the 'html' can be accessed by going to www.pitt.edu/~username.

(Reply to this) (Parent)


Page 1 of 3
<<[1] [2] [3] >>

Create an Account
Forgot your login or password?
Login w/ OpenID
English • Español • Deutsch • Русский…