I know more, please.
Yeah.
Okay.
Okay. I have to remember if I do that, then I get like three requests or something so anyway so I'm according to the cloud.
Okay.
Good morning, let's go ahead and get started. Oh, I just close my door here.
So, so let's talk this way I want to talk about today. sign meant one was done.
So if you want to go ahead and start on assignment one you can. I just have a few more questions to add I'll show you. So right now you'll notice this side.
So look, if you see this right here, this the sign is still being developed here are these things. You're seeing a little bit in the middle here. Yes, and there's no template because the Yes, because it's not finished because right now there are 2468 1012,
I normally want about 20 points in
another 20 points
will see a question so I'm adding a few more questions.
The deadline is October 1 right.
So, just to give you an update on the schedule here of how we're running things. So, one thing is I know this is a bit compressed, is because we've got the midterm, well the midterm is scheduled for October 19.
So, we're a little constrained by mid term time and
mentored time and the break.
Yes, the template isn't there yet because all the questions aren't there yet so you can work on them, but give me a day or it should be up later today.
So I'll October.
So we're the midterm is on the 19th year.
And the 11th is is Thanksgiving. So we have, so this is the midterm. This is when I'll review things. And so basically the second assignment is do here.
And so your first assignment is do here so basically just you know two weeks and stuff. So I'm going to try to get the as a second assignment out a little bit earlier but the idea is that if you look at this assignment.
It's nothing particularly enough to draw to.
What have I got here is I have this little bit of this is a really simple program.
You know there's these questions there are these answers, you know this little thing to ask questions and this. And so what I'm going to be asking you about is things like how do you iterate through the list.
Basically how do you get command line arguments, how do you get environment variables, and then the rest of the questions will be out things like where things are in memory and stuff.
And then here Here I'm asking you how have questions represented assembly language, you know, where are things stored in there so this is all stuff from tutorial to.
So, so yeah so that's the. So the idea is that the tutorials are preparing you for the assignments, so if you spent your time on the tutorials, doing the assignments is like, Oh, I know how to do that boom boom boom, I'm done.
But if you haven't been working hard on the tutorials, you'll come the assignment go like this is hard. So, so, so that so well and, and by the way I am.
I'm
Joe, if you ask if you
don't ask if you miss polls, because if you miss the pole you missed it.
So, so up for a tutor one to do we need to meet with the team for October 1. Yes.
they're due on October 1 with the first with the assignments because you're supposed to do them first to help you with the assignment, you know, will hold will hold your hand.
Okay so
yeah so tutorials wanted to should have covered everything required for us to able to tackle a one exactly what is required for assembly, are we able to read right assembly code.
So.
this is very big as a subject there's lots of stuff to teach.
I, it's more than you know I can fit into one class, so you can spend several classes learning, I mean, this is a very deep subject but, and which slice of it is most important is actually a bit debatable so what I try to do is teach you specific things
and more importantly teach you how to figure out things.
Okay. Can you submit tutorial to anywhere. I know there's going to be a this, I'm.
You're too.
okay so
these tools.
So we go through the tutorials and then go into the assignment, but if you find part of the tutorial really hard. Maybe you're overthinking maybe you're probably put too much into it, maybe then skip it but try to figure out what exactly it's asked me
for mostly tutorial, and then you can go on to the assignment. So well I'm way behind my questions here. Hold on. So,
In tutorial to on sections as getting an error. Okay. Kate, if you can show me the question in a second, I want us. I think I know which question you don't wait, I'll check that.
Yeah.
I'm
Alex was saying I said so the to ask about the due date.
You should try not you should try to hit the bright space deadline, always feel.
So, so if you finished assignment I mean tutorial one, you're doing great, you should be working on tutorial to now, that's the right way to do it. I just have some of you will work on a tutorial and get kind of confused and get a divine it's like, Don't
because this course can move kind of fast, but you have some flexibility.
Okay.
Okay so okay so normally I set the assignments. when I say a date it's normally by midnight.
Okay.
Lucas, can you still ask your TA to go over your tutorials one in a meeting.
Yes, definitely. That's exactly what you should be doing. If you have questions, that's it. That's the entire point of doing things. I think this way is that I want you, when you go like, I understand what's going on.
And wait, I don't understand what's going on. Okay I got the answers but I don't know what those answers really mean.
That's exactly when you should be talking to me or TA and going like what the heck is going on here.
And, you know, it's fine if you talk to the TA TA explains and if they don't explain it well enough come to me, I'm perfectly happy to do that.
You're th First there's a lot of you and not so many of me so I should not be probably the first person you're asking lessons in me if it's a lecturer in office hours fine But otherwise, try going to them first and then if you find you know things aren't
clear asked me posted a forum that also, that's what that's for.
Present relevant channel.
So,
do you think it's possible to take questions at the end of class.
Oh,
you're saying, I think some of your board. Okay, good question.
See, so we say amongst each other.
I like to guide like just get things out of people's heads and stuff and I'm sorry. So, good point.
I'll take this bear up.
So let's, let's try us the next time we'll move in so at least are going over material instead of these, These things so let's move on.
So tutorial
tutorial to let's, let's start looking at those things.
The ta is so.
They are marked for participation.
Remember, so they'll give you some feedback but talk to them.
So let's go back from here, let's go to tutorial two.
So we spent as we started talking about assembly language static linking dynamic linking at last time and we were talking about how these up.
There's a lot going on the hood we saw the assembler we saw the compiler we saw the linker, all those things being run you can see them by running GCC dash v.
Yeah.
I get if you're gonna have a side conversation that I don't need to read, please put it on bright space, rather than here.
Thanks.
Let's go on here so we so what. So, first off, I need to address the El trace issue, because I figured out what was going on with el trace, and it was, I'm sorry.
Did I say, I met teams. Thank you. Yes, teams please no discussion on bright space. Yes.
Let's, Let's go ahead and get this year.
Focus.
So, do it this way. Let's move this over here, because I'm just
go. Good.
Okay, so.
Okay.
Copy.
Okay, so we got our hello world here. Hello, see.
Yes. Yeah, Prague Nazi is you fill in the blank for the appropriate program, yes, that that's what Prague is
part of the reason why I put Prague. See, rather than putting something else is for you to try and parse the line as opposed to cut and paste it.
A lot of you are a number of students come to me go like, Where's Prague, like.
Don't just copy the command. What is it saying.
So, if we just do a GD cell.
Hello got seed.
Hello.
l trace.
We do this.
We get nothing, it turns out there was a change in how things are compiled by default.
So, if we just do this we don't get that but if we instead compile with.
We out of the actual lazy options.
Then you see we actually get something like put us.
And this is more what we expect.
There's different ways of making, you know.
Yeah, yeah no pie works, I've updated tutorial to to include this dash the stuff. But it turns out there's another, so it all has to do with how libraries are loaded, and we have not covered enough concepts to explain this yet, but I will explain what's
going on here, because you actually see the evidence, with running as Tracy Hello Tracy info is there, but you can actually make outraise be much more aggressive.
Check to see what their. That's why I have this here okay oh yeah dash access case that x.
So if you do this, you'll notice that they'll trace dash Hello notice it's basically registering all these function calls that are happening.
And they're just happening all over the place here. There's just, yeah.
As far as I can tell, this is, this is all stuff that's in put ass.
So,
let's see, you know.
Right.
Yes.
So,
so I just wanted to. So I tried to explain a little bit about what's going on with el trace. So, el trace is this program for watching calls to library calls.
Yeah, so.
So that's the key difference vl tracing SL traces inside of the process. And l traces inside the process as traces system calls that goes outside of the process.
And so really what we want to understand right now is what is inside of the process.
So two things that we haven't talked so much about what but, but are relevant here are
command line arguments and environment variables. So these are just. This is just
so there's the system called call Exactly.
And if we go back to tutorial here to tutorial one. So if you look at the if you spend some time looking at tutorial one we're going to go over this in much more detail soon.
They'll be tutorial three, but why I wanted to show if you looked at this code here, there was this fork and those exactly he and you've seen this in 24 one, but this is a version of exactly he
was that but this is this call right here is making an executive system call the executive system call.
So here's what the executive system callers. It's excuse the program for to bypass name. It takes three arguments, it takes the path name, ie the program binary you're running.
It takes also RV, which is the command line arguments years passing to the program, and the environment variables that you're passing that it gets.
So, okay, so we have a question here so the program has communicate with the colonel in some way if you only have library calls with X ray show system calls that are made in the link libraries.
Yes.
Good.
Okay.
That here.
So you have a special operation assembly layers called Cisco assembler converts the right machine, no code. That's how you make some calls, you can't do that in regular C code.
the libraries have special things to make that happen.
So you make library calls a library calls, make system calls.
One of these, and that's why actually like
exact VP, these are library calls.
The exact VP is a library called that later makes the executive assistant.
We will later try to make the executive system called directly, But keep in mind this difference is very important to know the difference between these two things.
Okay.
So, so we have.
So the way.
So, when we make an executive, he call those things get put into the, into the process or given to the process.
Well, I say.
That's really the key thing about these command line arguments and put into the process. They're like other variables that are in the process, but they don't come but normally variables are all defined by your code.
These aren't. These are defined externally and put into your process.
Yes. Yeah, yeah library codes provide the system causes okay so that's good.
Thank you, mother for explained that I'm.
So when I say environment variables, and I say, but let's be, let's be concrete here find.
So we've got this code here.
Here is, you have this, you call me and classically we say in Unix, we say, you know, into, you know, into arg C sharp point an RV RV has the, you know, this is where the command line up the command line arguments come in, or exceed is how many there
And then there's all, then you can also add. You also add in the environment variables this way by adding is, is this year, or we can say,
I think, I think that also works.
I have to check my specific syntax that you need to specify it as a global, the environment variables, either as this global variable thing or you can do it as a argument to maintain.
But.
so, directly the colonel past those command line arguments environment variables into me. There's one thing here you go, here's what it is, but indirectly really what's happening is, whoever made the executive system call specified.
When they made the executive system call, they specify the executable. And the command line arguments and the environment variable that was pod to be passed in, and then he library wrapper around this, if you leave out part of this has to fill in the
blanks.
Okay, okay good We're having a little discussion on dynamics and.
Yes, opening a reading files so yes okay you're, you're, we will get to that dynamic and static libraries in a few minutes but this, this is exactly what you're supposed to be thinking about in the chat right now we're talking, you're talking about how
to fit the pieces together. And that's the thing I can't do for you is like you're going to see connections all over the place between these concepts.
You need to bring make that bridge calcium all kind of fit together in a puzzle go like, Oh, that's what's happening.
That's your mental model.
So back to the trailer instead of our variables.
If you go to the tutorial tutorial to specifically.
There's this program 3000 men view.
What 3000 men view is supposed to do is give you insight into what's happening with the memory map, and specifically it's doing things like where is RV, where is MP, where are these in memory, and how do they compare to these global variables that are
set up here and these local variables.
And is there some pattern to this. And
so like if you.
Let's go ahead and
making that bigger small.
So, notice that it says put ass memory report, and it's got this print f check. And then we see this whole string so that corresponds to us, looking at the code here.
So notice what happened here.
How many print we made a whole bunch of calls to print off. Right.
But, did we end up making.
How many calls to print f did we make we only made one call to put ass. And in fact, also, we now do an L trace
trace.
So,
so if you look at the system calls. We'll talk about the ones that happened just before here, but this is. Oh.
Ha.
I'm liking all trades less than less.
I was thinking that the print have said all been consolidated into one big right call.
But very clearly that did not happen.
Okay, so.
So the process was excellent outside of social spaces. Yes. so if a process wants to access something that you cannot get a pointer to, if you want to call it.
So this is all stuff that you can get pointers to. If you want to access similarly code you can get no code for you know pointers that like main as a thing any code you use as a function you can get the address up you can call it that stuff all in your
process but you want to get outside of your process.
You have to do something else and basically you have to do a system call.
Can you add assembly commands and see yes it is possible to add in line assembly, I'm not going to play with show by simply
is there, by the way, is there a way to keep the chat history, there's a lot of explanations, the chat history is all on the chat history is all on bright space oldest I mentioned this year.
I don't post there I'm
don't post the chat to my wiki, I do check post the video
to it but I don't post the chat because if I did that would probably your names on public and that's not so good.
So we've got this.
So, so what l trade used I thought we used to be more helpful but I did this, and you see that you only see one put s, and then you see all these things.
But that's, you know, as traces giving you a much more detailed view of what actually was happening in terms of you can see here are all these rights system calls happening.
And then you actually see this, which I will discuss in a second.
And then you see all these rights.
So, what is.
So let's start talking about the system calls at what they're doing so right.
This should be pretty straightforward.
away before.
Before I do that.
So what sort of data structures are the stored in.
And this is
important to know, because if you're ever trying to manipulate now turns out there's a bunch of library functions that lets you manipulate these things in very easy way So in principle, you don't have to know this but this is an operating system class.
So we talk about those kinds of things.
So you'll see these up.
It's his character, your character path name okay that's just a string in C which is no strings arrays of characters.
But this is a pointer to an array of strings, as both of these are.
Yeah, exactly. So,
so, Oh you know right from
the man's man page says you are a must be true I know so.
So this is.
So it's like a sea array.
The, this, this array of these arrays of strings are also no terminated. So, each string is no terminated.
And the array is no terminated.
So we say no terminated know is.
Yeah. Yeah, exactly. Well yeah backslash zero is no which is the zero bite, as opposed to the number zero, which is asked the something. So, it's by, by binary zero.
So if you look at the assignment.
I just want to show you a little parallel here.
Okay.
There we go.
If you look at the code here, you notice these things.
The questions and answers are in the same format as an PNRV. So just to give you some practice. They're kind of the same thing. So you'll, so when you try manipulating them and do things with it, you'll, you'll be practicing that so in case you're wondering,
that's why they're there like that.
Okay so, so this is fine for you to Congress like what's actually in the environment array, what are the values in there, what do they look like you have all the tools for looking at this, so I suggest you try viewing those entries and seeing how their
formatted libraries that let you manipulate environment variables will hide these from you so take a look.
When you say a variable and array are no tags that mean that they're to backtrack no terminations at the end of the array.
Yes.
Yes, there are.
There are there well.
The last string in the array is no terminated.
And the last entry is not terminated, but how those. No, actually it's not.
You should draw a picture with all the pointers to really understand how things are laid out.
Because.
Why is that happening.
Do we use environment the same way as RV environment environment variables are you use them a bit differently. And I don't want to talk about them, I can talk about them more later.
But go and play with them some.
Actually if you're asking, are they are the nose laid out, look at the code in assignment one and play with them and see how it is it's.
I don't want to just show you the data structure play with it and you should be able to understand it.
Both now so I want to switch gears now and talk about system calls so
y'all know the reason right system calls.
Just to review.
So, you read.
You see this right just did here, this is right one.
This is not what I want.
This is what I want.
The SEC this the right to, because now there's different sections, one is for commands you do on the command line two is more for C library stuff right writes up to count bytes.
So same honor.
So, When you do the reading right
system calls. They take a file descriptor I buffer and a size and so read, you know, read from the you know what at the file descriptor and right right to the file descriptors went back and forth the buffer.
Yes,
increase the height of the lecture notes, I'll do that in a second girl moments I'm going back and forth between the windows.
But I'm.
Ah.
ok, I'm Tom you're asking about environment variables. Think about that a little more. What's uh what's the buffer.
Okay.
So, what is that buffer, this buffer here.
Oh, I think it's the idea of the file so this ok so the file descriptor. So, it identifies the file that we're accessing.
Yes,
this buffer is just an array.
It's just an area of memory, we normally think of this as having characters but I can have any binary data, but it's an array and we telling it how big that array is with the account with account parameter is saying, Take this many bytes and write them
to the file, or read them from it.
So.
follow the script Robin
news file descriptors are just numbers.
Where do we get the.
Yes. So, what, where's that number come from.
How do we get that number.
Remember that.
So, yeah standard on has a phone script of one yes, from a system called which system call open Yes.
So again.
Okay, here's the open system call and there's a lot of versions of it but the main thing let's look at this face of one.
It takes a path name, and some flags. We'll talk more about open but the important thing is the path name.
That's you're under the full path of the file you want to open, and it returns a number and the number is the file descriptor.
So who interprets
who interprets, so the colonel Yes.
every process has.
So that logically.
It's not necessarily implemented this way but you can have this mental model that the colonel maintains an array for each process of the files that are open by that process.
So you do and when you do an open, you get a number of back because it grows open it and that means that it has mark that file is being open for that process.
How do I view the man for right to instead of right one you just say man to right. So like, I mean, if I'm.
If I go here to the command line.
So I just wrote man to write that gets you the second one.
So the files address is in the array and the kernel and the false.
So.
there are these complex structures in the kernel, that the colonel maintains an array of them.
And those correspond to open files. So when you have a file descriptor you're basically saying, the first open file your entry zero.
Now,
can you see me. Yes. Yes, I can.
Well from the shell.
See how do I see what the things are.
So, here's where I'm going to tell you about something.
So,
Windows doesn't really do extension file extensions either we'll talk about file extensions in a little bit. So there's this cool thing.
If you go into slash proc.
And you do an ls and slash proc.
You will notice that there are all these things, these are all directories.
So there's these are other files that are there, that tell you all about aspects of the colonel but the number directories are information on processes like like 29843.
Where is
okay this this process is running evolution address book factory. Okay now I got lots of processing going on my system. I'm curious what file descriptors that has open so they're going to fb.
I can see that this thing has a bunch of open files. So 012345 678-910-1112 and these are all referring to all these things.
Yes, so.
So profit tells us all kinds of things but I'll show you something so if I do PS, you saw this, what if I asked trace PS.
The number stand for the process ID.
So just to summarize what you're seeing here.
So PS, how does PS get the information on the currently running proxies. It's just looking at slash proc.
Yeah, PS does many system calls in slash proc.
Not just me. So the numbers are the process ID. So remember when you do, when I do a thing like
if I do this, this is showing me the process. If I do this.
This is showing the processes that are running on my system this is the process ID ID.
This is the user that's running it. This is stuff watch memories. We're going to, there's lots to talk about here, but the thing to know is, these are different running programs on the system currently, and they are identified.
what just happened.
Well, no nothing. I have no idea what happened there that was very weird
fiction, to cover.
Okay, I'm, I'm back.
I'm just okay look I've got my chat.
Okay. Whoo. Okay.
Okay, good. I'm just catching up on the things.
Okay, and hopefully things are still recording.
I don't know let me check that hopefully it is.
Let's see.
Like crack captioning is happening, recording is continuing.
Great shifts.
So, I wonder how that will show up on the things but let's go back to share.
Part of my screen.
Okay, we're back.
Just set singing to my machine.
Okay, good.
Back to my next start talking about processes and of course things mess up. Sure.
so all the quick question about proc
is my cameras still lacking a bit okay.
Rich so much. It's so I'm
so proc shows the currently running processes with their PhDs. Yes, that's, that's exactly what it does
is my camera, I still lagging now hopefully it won't be Yeah, I don't know, sometimes.
Hopefully my internet can be a little more stable right now that's just.
I'm on gigabit, you know, internet, I should have plenty of bandwidth. But anyway, well let's just try continue now may shift you to work, their shift is not in here right now that was certainly something that occurred to me but no.
So, So what's related EFDNP it so that's the. So we go to slash croc looking slash proc you see all these process it.
But if you look into any of these prophecies, you want to see what's going on with one of them. You'll notice that in here, in addition to all this stuff, there is a file descriptor directory.
Oh, I can't do that 168.
Okay, let's go into 6257321 go to the ones that I have permission to it, they're running as root.
And here we go here all the file scriptures. And if you do an ls dash LA, you can actually it actually represents these as this.
Well, I can see do it. I don't want to do pseudo right now on a zoom call.
And besides that, you're telling us like now.
Yeah. Yes, exactly. They are not they are in memory. Exactly. there is no storage associated with slash proc.
Let's do a quick poll here.
Let's go do that.
I'm not done any today.
Okay, can I figure out how to do a poll.
Why can't I
stop my share for a second.
I lost my ability to polls.
I'm the host.
There is.
Why does zoom do this to me.
Yeah.
Yeah, I'm
chapter one and two.
Let me see what can I, I'm
okay. I'm good.
I'm gonna do one in teams, just to have one, as a backup here. So I want to ask.
Okay, I just posted a pole and I'm they're asking you about a file descriptor on teams it file descriptors of pointers.
It seems like my audio is still working click and see the transcription. It's on. I put it in the team's chat teams channel.
I can't do it here in zoom, because zoom.
angry.
I'm not sure what to parse some of these things though I sent the Yes.
Okay, well, I'm gonna let you all mostly answer before I answer this thing.
But think about this for a second.
But I will show you that in here. Oh by the way, uh, we can see
here's the environment variables for a process.
And here are the.
Here's the command line.
And here's the command line so this is me running Firefox
is no I think yeah.
Okay.
Okay, I'm gonna, I'm gonna give the answer now.
You can't log into complete the polls okay so you should.
you shouldn't be able to log into teams.
So, the environment variables and command line arguments are put there by the colonel. the colonel shows you what they are, if you asked for it, but they are in the processes address space near process level data structures, they can be manipulated by
by the process and arbitrary ways, it's just data for the process.
But the, you know, this is a big difference from file descriptors file descriptors are references to Colonel data structures which are completely opaque, you can't see the inside the file descriptor you only access it via system calls.
And that's why when you basically give me a file descriptor number you're saying, I want this data structure.
If you, by the way, if you chatted in the chat, you're going to get participation marks, so don't worry about it just.
yeah.
Okay. Yes, but but but try not to say just, yeah.
But,
oh boy.
But folks. Please try to say something useful.
Nothing not the highest nice, but yeah okay.
Okay, well it's something useful.
Anyway guys, everyone's a clown.
This is very important to realize what's in the process, and what's not in the process. So.
It's an end, but it's still a small thing. I mean,
no.
Yeah, five files a little little integer.
You don't have. we don't there are no file pointers in.
So, an open file sync loosely is this data structure that the colonel maintains to correspond to a file that a process has open regular process kit see that data structure, it's in the kernel but they get this little number.
This. To do so, to enable to do to manipulate it using system calls, open rewrite
all the system calls that take
a lead right but open returns is the file descriptor
those the ones that use it.
Well descriptors are for any files, including things. So that's why you call you know it's a request for yourself.
Oh right okay so thank you for the file player. Oh, right.
C library has filed for years as an abstraction around file descriptors.
I completely didn't even think about that up inside a file a file pointer and from the C library is a file descriptor.
As no way destroy Free File strikes beside close.
If you terminate the process.
You can free up all the resources associated with the process, including the open files.
So, the number is. So, what those, let's talk about that now.
Standard in standard out standard error. When we talk about those from see what we're really talking about is file descriptors 01 into.
Does the colonel treat those files scriptures differently.
Yes.
What are what again.
So,
so when I do a print so let's, let's review the seed program so hello. So when I do a print half print half by default, goes to standard out.
If I read by default I read from standard in, and I want to output an error, it goes to standard error, this is, this is standard see semantics. But what this actually means is that I am interacting with file descriptors 01 and two, and in fact we can
see this when we.
So you see we did this right here.
We did right hello world, and this thing got stuck in the middle because it actually got written to the terminal, but we did a right here, it wrote to one, because it wrote to one because one is the file descriptor for standard output.
So scanner would be read to scan f would actually be read zero, because that standard input.
One.
Yep, areas right to.
Exactly.
Exactly, yeah so.
So the Carl give me a higher priority so.
Colonel doesn't care about file descriptor 01 and two it treats them just like any other ones. It's a, it's purely standard in out near is purely a convention for user space, and we will talk more about how that convention happens in tutorial three when
we start talking about IO redirection and what shells do.
So I'm going to stop here and I'll stop recording, and if people have