mikeizbicki / ucr-cs100

open source software construction course
Other
485 stars 407 forks source link

Hw4 Part 1 #1488

Closed ZhuLeon closed 9 years ago

ZhuLeon commented 9 years ago

Hi, I'll working with Lauren Boyd on this project.

To contribute back to the open source community, we were thinking about adding documentation to something that already exists. Specifically we were thinking about doing a tutorial on gdb, cppchecker, bash's script call or adding onto the already existing valgrind documentation. Or making/adding onto tutorials on syscalls. Or we could also create a cheatsheet for gdb or bash. Which of these would be approved?

mikeizbicki commented 9 years ago

Any of those topics would be fine. But before I approve the topic, I'll need you to:

  1. Pick one of them
  2. Explain a weakness in what already exists for that topic; try to be as specific as possible
  3. Explain how you'll fix it; again, try to include a specific example
ZhuLeon commented 9 years ago

We'll choose the option of making a bash cheetsheet. I believe that doesn't exist yet? We'll make one similar to the git cheatsheet for popular and most useful bash commands.

mikeizbicki commented 9 years ago

There is already a bash cheatsheet at /cheatsheets/bash-cheatsheet.md. It has room for improvement, but I think that would only be a one person project.

ZhuLeon commented 9 years ago

How about making a tutorial on how to install linux on Windows and MacOS?

mikeizbicki commented 9 years ago

That idea won't work either. There are already hundreds of these tutorials, and they cover more edge cases than you'll be able to think of.

A related idea would be to cover some of the differences between Linux and MacOS at the syscall level. This would require a fair bit of research, but would be very interesting.

ZhuLeon commented 9 years ago

Okay, we'll take that idea! We'll make something a long the lines of a documentation comparing and contrasting linux syscalls and macOS syscalls.

mikeizbicki commented 9 years ago

Sounds great!

You should look up what it means to be POSIX compliant and relate this back to your writeup. By the next deadline, you should:

  1. Pick a small number of related syscalls that work differently under Max and Linux (something like read,write,open, and close; or maybe exec, fork, and wait)
  2. Have a short example program written that works differently depending on which OS you run it on.
ZhuLeon commented 9 years ago

Will do. Thanks!

ZhuLeon commented 9 years ago

After looking through the internet for a while. From what I understand, some major differences between Mac OS and Linux are:

  1. Mac OS is based on BSD while Linux is based off of UNIX.
  2. Both systems are POSIX compatible.
  3. Linux is open source while Mac OS is not open source. But overall, they seem very similar to me. From reading the man pages of exec, fork, and wait, there doesn't seem to be many significant differences. There are a few differences I've found from reading, but I'm wasn't too sure that those differences would be relevant to this course and how we were using these syscalls. I've seen that read and write seem to have more syscalls in Mac OS than Linux but overall read() and write() themselves seem similar I have yet to test each syscall on Mac OS but so far, judging from what I've read from comparing the man pages, I'm not seeing that there would be a noticeable difference in the two OSs. Perhaps doing this would give me more information? That being said, I feel like I've missed the point. I was expecting to find a lot of differences but I haven't found much. So my question is, am I looking in the wrong place? and what was I supposed to find?
mikeizbicki commented 9 years ago
  1. BSD is a type of UNIX, so both Max and Linux are based off UNIX
  2. Correct
  3. Sort of correct. Remember that BSD is open source.

You have to dig fairly deeply into the edge cases of the syscalls to see where they differ. In particular, the differences will be in what the flags are and what their effects are. You won't find any differences just randomly trying things out.

It's still fine to find a different topic if this one doesn't seem good to you.

On Tue, May 19, 2015 at 1:32 AM, ZhuLeon notifications@github.com wrote:

After looking through the internet for a while. From what I understand, some major differences between Mac OS and Linux are:

  1. Mac OS is based on BSD while Linux is based off of UNIX.
  2. Both systems are POSIX compatible.
  3. Linux is open source while Mac OS is not open source. But overall, them seem very similar to me. From reading the man pages of exec, fork, and wait, there doesn't seem to be many significant differences. There are a few differences I've read but I'm wasn't to sure that those differences would be relevant to this course and how we were using these syscalls. I've seen that read and write seem to have more syscalls in Mac OS than Linux but overall read() and write() themselves seem similar I have yet to test each syscall on Mac OS but so far, I'm not seeing that there would be a noticeable difference in the two OS. Perhaps doing this would give me more information? That being said, I feel like I've missed the point. I was expecting to find a lot of differences but I haven't found much. So my question is, am I looking in the wrong place? and what was I supposed to find?

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103398480 .

ZhuLeon commented 9 years ago

Alright, I'll get back to you about this by tomorrow. I'll have to think about what other topics we could do.

ZhuLeon commented 9 years ago

Is there any existing documentation in this repository that you think we could add to? Or any documentation that you would like to see added?

mikeizbicki commented 9 years ago

We don't have a lab directly related to pipes/io redirection. Maybe you could come up with one?

On Tue, May 19, 2015 at 2:10 AM, ZhuLeon notifications@github.com wrote:

Is there any existing documentation in this repository that you think we could add to? Or any documentation that you would like to see added?

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103408811 .

laurenB93 commented 9 years ago

Would the piping/IO redirection lab write up be considered a two person assignment? Because Leon and I were working together on the MacOS and Linux project.

mikeizbicki commented 9 years ago

Yes

On Tue, May 19, 2015 at 9:42 AM, Lauren Boyd notifications@github.com wrote:

Would the piping/IO redirection lab write up be considered a two person assignment? Because Leon and I were working together on the MacOS and Linux project.

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103585306 .

laurenB93 commented 9 years ago

Here are some of our ideas for the project. What are your opinions on this lab proposition? Our idea is to make a lab with the purpose of teaching students the basics of how dup, dup2, and pipe work. This way students will have a better understanding of the piping/IO redirection assignment and be better prepared.

Ideas: I/O The purpose of this exercise is to get familiar with how to use dup or dup2 in I/O redirection. Exercise: Make a program that when executed will take input from stdin and outputs to a file instead of stdout. You must use dup and dup2 syscalls. Don’t use ifstream. You will also restore stdout at the end of the program.

Piping The purpose of this is to get familiar with how to use the pipe syscall. Exercise: Make a program using the pipe syscall to take output from first process (e.g. ls) and connect it to the second process. In the end you should execute your a.out and run program | program2 and program2 should take input from program and output it to stdout

mikeizbicki commented 9 years ago

My initial impression is that:

  1. There's not enough of a contribution here for two people to work on.
  2. There are some mistakes in your wording that suggest to me that the final lab might not be very effective.

If you still want to do this project, we'll need to talk in person about how to solve these problems.

On Tue, May 19, 2015 at 1:39 PM, Lauren Boyd notifications@github.com wrote:

Here are some of our ideas for the project. What are your opinions on this lab proposition? Our idea is to make a lab with the purpose of teaching students the basics of how dup, dup2, and pipe work. This way students will have a better understanding of the piping/IO redirection assignment and be better prepared.

Ideas: I/O The purpose of this exercise is to get familiar with how to use dup or dup2 in I/O redirection. Exercise: Make a program that when executed will take input from stdin and outputs to a file instead of stdout. You must use dup and dup2 syscalls. Don't use ifstream. You will also restore stdout at the end of the program.

Piping The purpose of this is to get familiar with how to use the pipe syscall. Exercise: Make a program using the pipe syscall to take output from first process (e.g. ls) and connect it to the second process. In the end you should execute your a.out and run program | program2 and program2 should take input from program and output it to stdout

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103661987 .

laurenB93 commented 9 years ago

What could we add to make it worth two people? Since this is due tomorrow, would it be too late? Would you be able to meet some time today?

mikeizbicki commented 9 years ago

We will have to talk about it in person.

On Tue, May 19, 2015 at 1:52 PM, Lauren Boyd notifications@github.com wrote:

What could we add to make it worth two people? Since this is due tomorrow, would it be too late? Would you be able to meet some time today?

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103664550 .

laurenB93 commented 9 years ago

When would you be able to talk about it?

mikeizbicki commented 9 years ago

I just had office hours, and I'm not available the rest of the day. Does tomorrow after class work?

On Tue, May 19, 2015 at 2:06 PM, Lauren Boyd notifications@github.com wrote:

When would you be able to talk about it?

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103667284 .

laurenB93 commented 9 years ago

I'm sorry I couldn't make it to your office hours. Tomorrow after class works. Does that mean this will effect our grade?

On Tuesday, May 19, 2015, Mike Izbicki notifications@github.com wrote:

I just had office hours, and I'm not available the rest of the day. Does tomorrow after class work?

On Tue, May 19, 2015 at 2:06 PM, Lauren Boyd <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

When would you be able to talk about it?

Reply to this email directly or view it on GitHub < https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103667284

.

— Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103669892 .

Thank you, Lauren Boyd

mikeizbicki commented 9 years ago

This will not affect your grade.

On Tue, May 19, 2015 at 2:21 PM, Lauren Boyd notifications@github.com wrote:

I'm sorry I couldn't make it to your office hours. Tomorrow after class works. Does that mean this will effect our grade?

On Tuesday, May 19, 2015, Mike Izbicki notifications@github.com wrote:

I just had office hours, and I'm not available the rest of the day. Does tomorrow after class work?

On Tue, May 19, 2015 at 2:06 PM, Lauren Boyd <notifications@github.com javascript:_e(%7B%7D,'cvml','notifications@github.com');> wrote:

When would you be able to talk about it?

Reply to this email directly or view it on GitHub <

https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103667284

.

Reply to this email directly or view it on GitHub < https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103669892

.

Thank you, Lauren Boyd

Reply to this email directly or view it on GitHub https://github.com/mikeizbicki/ucr-cs100/issues/1488#issuecomment-103670156 .

ZhuLeon commented 9 years ago

So just to confirm the structure of the lab document from what we talked about on Wed,

  1. General introduction to I/O redirection and piping.
  2. Some basic information on dup, dup2, and pipe syscalls, Basically, inclusions, dup and dup2 definitons from the man page, return values
  3. Detailed information of how dup/dup2 works with some pictures and an example
  4. Lab exercise The exercise will be similar to what we have to do for the assignment but in a more general case correct? For example, the dup exercise one part would be making ls > outfile work, another for sort < file. And then another one with piping. Of course, they would need to use execvp and fork.
  5. Lab exercise solution We'll be doing this for pipe as well. Does this sound good? We'll have 1-4 ready by Friday. What folders do you want us to put these in?
laurenB93 commented 9 years ago

Hi Mike, I'm not sure if you saw this comment but we are not sure what folder to put it all in. Should I put it in the labs folder?

mikeizbicki commented 9 years ago

Please put it in the labs folder.

ZhuLeon commented 9 years ago

Hi Mike, some questions.

For I/O I was wondering if this kind of I/O exercise would be okay with you. Writing a hard coded line to an file. Reading lines from a file and outputting it to terminal.

For the piping, you told us to do an exercise that does history | grep g++ but I don't think execvp takes history as an argument. It just tells me "execvp: file not found". Also I'm assuming that parsing isn't part of the lab, so I used this to pass into execvp: char* cmd[] = {"history", NULL}; but this generates a compiler warning conversion of string to char\ warning. Is this fine?