Unix system calls (2/2)

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 92

  • @louis9116
    @louis9116 2 роки тому +24

    came to learn about syscalls, but this man just summed up my entire OS course. Cannot thank you enough

  • @W1Wyrm
    @W1Wyrm 4 роки тому +79

    Thanks! Almost 10 years later still completely relevant and cover a lot of ground.

    • @Kabodanki
      @Kabodanki 4 роки тому +3

      there's no use for the base of syscall to change

    • @lawrencemanning
      @lawrencemanning 3 роки тому +9

      @@Kabodanki Yup we'll be stuck with this 1970s Unix forever....

    • @JosephRawsonWorks
      @JosephRawsonWorks 2 роки тому

      Bloody fofum buffer overflow

  • @rweaver6
    @rweaver6 7 років тому +57

    High quality tutorial. No fumbling for words, moves along efficiently and covers the architectural fundamentals.

  • @godnyx117
    @godnyx117 Рік тому +2

    I have no words! Wherever you are, I hope that you are doing great!

  • @ThunderAppeal
    @ThunderAppeal 5 років тому +21

    This guy is brilliant.
    So refreshing to hear this explained without some foreign accent by someone who knows exactly what they are talking about.

  • @photoallergic
    @photoallergic 8 років тому +7

    Aw man, thanks so much for these videos. I'm a teaching ass. for HPC at uni and I know all this stuff, but having it read aloud and so well explained puts me in soothing, precious slumber with a peaceful smile. "Yes ... yes, that's how block devices work ..."

  • @mikaelohlin6869
    @mikaelohlin6869 4 роки тому +3

    Partition 0 is where the formatting pattern is stored, so the first readable partition lies on top of that layer. That is also why the disk isn't as big as the producer tells you because it takes some bytes each slice that gets marked.

  • @takshpatel8109
    @takshpatel8109 2 роки тому +1

    One of the best Linux explainer 🌟🌟🌟

  • @rancidbeef582
    @rancidbeef582 3 роки тому +7

    Just to be pedantic, you can link() the same file to two different filenames even in the same directory. For example, on an old Unix System V machine I used to use where disk space was at a premium, the /bin/cp, /bin/mv, and /bin/ln programs were all linked to the same actual file, since those operations have a lot in common. When run, the program will check argv[0] (i.e. the file name of the program), to figure out which operation to perform. Pretty sneaky!

    • @johnnybravo2342
      @johnnybravo2342 2 роки тому +5

      busybox uses the same metod i think :)

    • @godnyx117
      @godnyx117 Рік тому +1

      That's actually very smart, even in modern systems. Like mentioned, Busybox does it and I plan to do the same in the future when create these programs in my language.

  • @МаксПреображенский-ы3у

    If someone wondering about real syscalls signatures, not just python-like pseudo-code, you can always type "man 2 " into your shell and get the answer.

  • @MrAeQwa
    @MrAeQwa 8 днів тому

    Great, concise and understandable explanations!

  • @Locane256
    @Locane256 7 років тому +2

    These videos really helped me round out my understanding of Unix basics. I would have been a lot more lost without being taught some basics first - these videos really helped solidify knowledge I had that was fragmented... created an inode table to map to a larger directory structure, if you will ;)

  • @berlin-unlocked
    @berlin-unlocked 11 місяців тому +1

    Super great video! Good for preparation for interviews)) in 47:47, in SISEGV, I think that "V" means "violation"

  • @Danscottmusic
    @Danscottmusic 8 років тому +10

    Thanks, these videos have covered a lot that I wasn't understanding!

  • @impaque
    @impaque 7 років тому +1

    Thank you very much for these series, they're very informative and very well presented.

  • @PIX_BMS
    @PIX_BMS Рік тому

    I wish I'd found these videos 12 years ago.

  • @CMDRunematti
    @CMDRunematti 4 роки тому +1

    lp starts from 0 because it always would have a printer, but wouldn't necessarily have a storage device (like back in the day when you typed your programs in)

  • @shirleyachara3809
    @shirleyachara3809 3 роки тому

    Great lecture with very useful example codes.

  • @Mr.Nichan
    @Mr.Nichan 2 роки тому

    39:04 I believe that's spelled "SCSI device", for "Small Computer System Interface device" (not, for instance, "scuzzy device", using "scuzzy", a 1960s coinage for "dirty", "grimy", "disreputable", or "sleazy").

  • @jacksonfive5180
    @jacksonfive5180 6 місяців тому

    Fantastic explanation.

  • @sasuke2910
    @sasuke2910 8 років тому +19

    A process can send signals to other that are owned by the same user? Does this mean that typical programs have the ability to kill each other?

    • @briantwill
      @briantwill  8 років тому +26

      +Jeru Sanders Yes, this is the case. It's one reason why 'important' programs tend to be set up with their own user account.

    • @omkarajagunde4175
      @omkarajagunde4175 4 роки тому +1

      At unix time signal were only sent for killing other processes and not for IPC or any other thing but as time passed developers found signals can be used for other good things for IPC sending interrupts etc .. There is a table like structure in U-area of each process where one column is all the signals supported by OS (19 signals supported in case of UNIX) and 2 second column consists of signal catcher function address passed as parameter by the programmer by calling signal system call in their programs then when a process is switching mode to user mode from kernel mode "isSig" algorithm is executed to see which signals are received by the process and not yet serviced and then to serve these queued signals "psig" algorithm is executed and if a particular signal is not specified with catcher function then default address corresponding to the second column of that signal consists by default 0 address which is exit() system call address and the process is put in Zombie state by the kernel.
      You can see signal macros in

  • @phyyl
    @phyyl 2 роки тому

    The V in SIGSEGV stands for Violation

  • @dixztube
    @dixztube Рік тому

    Learned a lot here. Thanks!!

  •  7 років тому +9

    thanks for this, far the most useful video on the topic!

  • @sourashismondal5060
    @sourashismondal5060 Рік тому

    Please make a video of how exception handling works internally.

  • @berargumen2390
    @berargumen2390 3 роки тому

    I watched this video like 7 years ago, but just know i undesrtand this

  • @smorrow
    @smorrow 4 роки тому

    7:56 "read works this way basically for performance reasons"
    And reading from the terminal.

  • @amandafalke7670
    @amandafalke7670 6 років тому

    Great videos that really complement my Embedded Operating Systems class. Thank you!

  • @iberianful
    @iberianful 3 місяці тому

    Great tutorial.

  • @patrickmullen2914
    @patrickmullen2914 Рік тому

    Great video. I learned a lot 👍

  • @hacker64xfn99
    @hacker64xfn99 2 роки тому

    I hope u see my comment as this video was not published 11 years ago : How does device drivers actually work in these system calls, are not drivers the ones responsible for managing their devices associated with, as they create their device objects ? In Microsoft Windows, what is the Device object file and is the symbolic link object (found in ObjManager.exe) same as these symbolic links mentioned in this videos ? Also, does the DevDevice file object (at object manager) contain block and character device files equivalent to the dev/ directory in unix-like systems ? Anyways, great content, keep up your work 😊

  • @haispdn
    @haispdn 12 років тому +1

    Very useful lecture.. highly recommended

  • @kamilkowalski776
    @kamilkowalski776 3 роки тому +1

    segv = segmentation violation ?

  • @Halogrunt1234
    @Halogrunt1234 10 років тому +13

    I was very entertained by your herp derp and bla bla example of nonatomic file writes.

    • @mcechss
      @mcechss 8 років тому

      "her blap" lol

  • @abdulmoizsheikh8031
    @abdulmoizsheikh8031 4 роки тому +3

    4:25
    Can someone please explain why a write() call is not guaranteed? I just checked the man pages for write and it clearly says that on a successful write call, the number of written bytes is returned. Have I missed something here?

    • @easilyexplained-inenglishh9491
      @easilyexplained-inenglishh9491 3 роки тому +2

      Hi Abdul!
      I had the same question, and found this in the man page for 'write', under 'NOTES':
      A successful return from write() does not make any guarantee that data has been committed to disk. On some filesystems, including NFS, it does not even guarantee that space has successfully been reserved for the data. In this case, some errors might be delayed until a future write(2), fsync(2), or even close(2). The only way to be sure is to call fsync(2) after you are done writing all your data.

  • @KillYourFinger
    @KillYourFinger 7 років тому +1

    your videos are a blast man! helped me so much! keep it up please

  • @nofmxc
    @nofmxc 2 роки тому

    I know this is old, but are the character device file buffers stored in the operating systems memory space? Or on disk? Or on the device?

    • @davidbekic6569
      @davidbekic6569 2 роки тому

      Been wondering the same thing, t'as trouvé la réponse?

  • @ziaahmad8738
    @ziaahmad8738 5 місяців тому

    Thank you!

  • @esantix
    @esantix 6 місяців тому

    On min 33:15: what does it mean there's a buffer for each block? All storage is "repeated" on disk and the buffer?

  • @xieliming
    @xieliming 12 років тому

    As he said in previous video, it is pseudocode in the styling of Python. The actual code for making these calls is C

  • @Mr.Nichan
    @Mr.Nichan 2 роки тому

    10:16 Given everything else you said here, it seems like it should have been mentioned what happens when you write when the marker is NOT at the end of a file. I'm guessing you thought it was obvious that you would overwrite the data, like a hard drive, rather than inserting data, as is now the default in modern text files, though it requires changing the addresses of every byte later on in the file. That's sort of implied by the fact that you only say it expands the file if the marker goes past the end of the file. In addition to simply being more complicated, inserting would expand the file no matter where the new data was written in, and would also require separate deleting calls for completion.

  • @rathnec
    @rathnec 4 роки тому +1

    Thanks Brian.. A doubt on segmentation, I think paging did not make segmentation obsolete, right?.. Page fault and sen fault are two different issues.. Page fault can't be considered as an error.. it just means that the page the process is looking for is not found in the main memory.. Seg fault on the other hand is actually an unauthorized access of memory area which cause the process to terminate.. Is this right!!?

    • @lawrencemanning
      @lawrencemanning 3 роки тому +1

      Pages and segments do the same thing and are a means to isolate address spaces. The V in SIGSEGV is short for violation I believe, and refers to segments because, presumably, the first UNIXes ran on computers that used segments for process isolation. So a context switch would update the various segment registers instead of switching page tables, as happens now.

  • @movq7539
    @movq7539 2 роки тому

    really good

  • @WeightlessFlex
    @WeightlessFlex 3 роки тому

    Do you have a Unix networking seriesor know of a good one

  • @adityanagesh4922
    @adityanagesh4922 3 роки тому

    Why can't unnamed pipe be used by unrelated processes? When we create a pipe is the r and w permission for the file only given to the real id of the program?

  • @JosephRawsonWorks
    @JosephRawsonWorks 2 роки тому +1

    I used mkfifo for named pipes

  • @fuanka1724
    @fuanka1724 7 років тому

    Excellent videos!

  • @subee128
    @subee128 9 місяців тому

    Thanks

  • @buihung3704
    @buihung3704 Рік тому

    I though ReadWrite is controlled by semaphores? You can have many reads at the same time but only 1 write can occur at any time. How the hell can you have multiple write and multiple read at the same time? Is it a really serious problem if 2 write overwriting each other in the buffer, results in corrupted data?
    Edit: Ah I get it, so the buffer doesn't have coordination by default, it solely relies on the human developers of a specific program (Dev team of MySQL for instance) to control the read and write explicitly using multiple techniques, one of them is using semaphore.

  • @supa1009
    @supa1009 5 років тому

    You sir, are a true legend!

  • @cyrilemeka6987
    @cyrilemeka6987 9 місяців тому

    49:58 what of SIGINT?

  • @shirleyachara3809
    @shirleyachara3809 3 роки тому

    Thanks.

  • @carloseduardomarciano1395
    @carloseduardomarciano1395 7 років тому

    Amazing video, thanks for the lecture!

  • @yourfutureself4327
    @yourfutureself4327 Рік тому

    💙

  • @MrFrankSpierings
    @MrFrankSpierings 11 років тому +8

    sigsegv => segmentation violation ;)

  • @RogueSignal
    @RogueSignal 5 років тому +2

    lseek might stand for Linear Seek since it goes down the line.

  • @m3hdim3hdi
    @m3hdim3hdi 4 роки тому

    I cant thank you enough

  • @idobenamram3743
    @idobenamram3743 6 років тому

    so good

  • @TheTarnonero
    @TheTarnonero 7 років тому

    good videos ! thanks for a good explanation!

  • @rne1223
    @rne1223 13 років тому +3

    is the website down?

  • @DrRChandra
    @DrRChandra 9 років тому +4

    mmmm.....no, rmdir(2) will not remove a file (you showed "remove a file or directory"); the only object it will remove is a directory. unlink(2) will remove anything except directories to which you have permissions to do so.
    It's also worthy to note a file continues to exist anonymously until there is no longer any process with it open. I used to run into that all the time with a database program which would create some temporary files (for temporary tables), and I needed to free up disk space because the filesystem was full. I could rm(1) them, but the disk would still be full until I shut down the database (and thus its process called close(2) or _exit(2)).

  • @LytGamingV1
    @LytGamingV1 12 років тому

    are all of these examples written in python?

  • @normally96
    @normally96 5 років тому +1

    thank you.I eager to join your course but I can't access the link in the description. Can you give me another link ?

  • @swapnilhitman
    @swapnilhitman 11 років тому

    Very informative ... Thank you.

  • @melvyniandrag
    @melvyniandrag 6 років тому

    very useful!

  • @luckyboy20021
    @luckyboy20021 6 років тому

    thank alot

  • @erikbmyname
    @erikbmyname 11 років тому

    Thanks for these!

  • @krzysztof-ws9og
    @krzysztof-ws9og 4 роки тому

    I have managed to divide by '0' without getting SIGFPE
    I have got +inf as a result

    • @xrafter
      @xrafter 4 роки тому

      '0' is charachter which is 48 in his maping in ascii
      But 0 is 0 not 48

    • @smorrow
      @smorrow 4 роки тому +3

      You didn't cause the actual computer to divide by zero.

  • @AmitKumar-zy9ug
    @AmitKumar-zy9ug 12 років тому +1

    i guess V in SIGSEGV means System V? but i can be wrong.

  • @coolwinder
    @coolwinder 8 років тому

    Can i ask one dumb question?
    How do i call e.g. chdir or mkdir...? Where is it, is it some compiled C executable, and if yes, where is it?
    So i am reading chdir man page man7.org/linux/man-pages/man2/fchdir.2.html and it tells me to include some lib , so there are functions?
    So if i want to call functions in C to read and write files i need to use librarys for reading and writing found on that operating system? So what is then, is it standard library that is writen separately for each OS, so when i am writing program in C i dont need to rewrite my program each time i want to compile it for different OS? And lib is calling open system call for function fopen for Linux, in windows it would call something else?
    This isn't realy one question, but my train of thought. Maybe i should put it on reddit (/r/Showerthoughts/) :D. Thanks.

    • @gigiduru125
      @gigiduru125 8 років тому +2

      In Linux these are in the libc library www.gnu.org/software/libc/manual/html_node/Working-Directory.html#Working-Directory.
      Linux and Windows have different APIs and system calls, fork() in Windows is called CreateProcess(), has different parameters and is part of the Windows (Win32) API en.wikipedia.org/wiki/Windows_API.

    • @omkarajagunde4175
      @omkarajagunde4175 4 роки тому

      @@gigiduru125 Yes as windows believes in thread based processing and at UNIX time their was only legacy Process based processing

    • @omkarajagunde4175
      @omkarajagunde4175 4 роки тому

      mainly chdir() and mkdir() at UNIX period was a system call, also i must tell you that chdir and mkdir are also internal commands of shell(shell have 2 types of commands internal and external), the code for internal commands like."ls" and ''cd" (chdir) is implemented by shell itself so their binary executable is no where separate but their code lies in the binary executable of shell, If a command is external command then it lies in /bin directory. Hope that helps !.. for further reading you may read Maurice J Bach book

  • @harishkumars3209
    @harishkumars3209 12 років тому

    i'm interested in developing os can u help me