Sponsored Content
Top Forums Programming Understanding read/write and kernel interaction Post 302354018 by Krothos on Wednesday 16th of September 2009 10:24:40 PM
Old 09-16-2009
Understanding read/write and kernel interaction

Ok, so I'm trying to finalize my understanding of read/write and kernel interaction.

read():

You have a library function that has as it's first parameter (what the open file to read from is), second parameter( a pointer to a buffer (is this the location of a buffer in the user area or the controller buffer in the kernel?) and a third parameter(# of bytes to read).

So, once the controller stores words from disk into its own buffer, the DMA then transfers the data to the main memory and the CPU gains control. My question is, what now? The purpose was to read a certain amount of words. So, are those words being returned to the caller once they are in the main memory or is an address returned of where in the main memory those words are located?


write():

First param(which file to write to), second param (again, unsure. Is this pointing to a buffer in the user area already filled in with the new words to modify the file with?), third parameter (how much you replace)

Main question entails how this even works as opposed to the read. Does the controller still need to store a certain amount of words from the disk into its own internal buffer?

I understood it like this: Controller's own hardware buffer somehow stores the words to modify the file. The DMA then uses the new block within the controller buffer to modify a file within the main memory.

Any help is appreciated

Last edited by Krothos; 09-17-2009 at 12:00 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to read freebsd kernel source?

I got the freebsd kernel source from the first install CD(in directory:\7.0-RELEASE\src\),isn't right? if so,how can i read it? Is there any tools? (4 Replies)
Discussion started by: zhouq3132
4 Replies

2. Shell Programming and Scripting

Find all files with group read OR group write OR user write permission

I need to find all the files that have group Read or Write permission or files that have user write permission. This is what I have so far: find . -exec ls -l {} \; | awk '/-...rw..w./ {print $1 " " $3 " " $4 " " $9}' It shows me all files where group read = true, group write = true... (5 Replies)
Discussion started by: shunter63
5 Replies

3. UNIX for Dummies Questions & Answers

Understanding read/write and kernel interaction

Ok, so I'm trying to finalize my understanding of read/write and kernel interaction. read(): You have a library function that has as it's first parameter (what the open file to read from is), second parameter( a pointer to a buffer (is this the location of a buffer in the user area or the... (1 Reply)
Discussion started by: Krothos
1 Replies

4. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

5. Solaris

Which file is read by kernel to set its default system kernel parameters values?

Hi gurus Could anybody tell me which file is read by kernel to set its default system kernal parameters values in solaris. Here I am not taking about /etc/system file which is used to load kernal modules or to change any default system kernal parameter value Is it /dev/kmem file or something... (1 Reply)
Discussion started by: girish.batra
1 Replies

6. Shell Programming and Scripting

i have no understanding of how to write an array or use one, please help!

im in a basic unix class and our professor speaks broken engliash so i can never understand what exactly we are doing in class and i have no prior experience with unix. we were given an assignment to make 2 files. one to Input 10 numbers and print out the biggest number, and one to Write a script... (1 Reply)
Discussion started by: wendyshephard
1 Replies

7. Homework & Coursework Questions

i have no understanding of how to write an array or use one, please help!

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: make 2 files. one to Input 10 numbers and print out the biggest number, and one to Write a script that can check... (1 Reply)
Discussion started by: wendyshephard
1 Replies

8. Programming

c++, raw sockets, stopping kernel write in header?

Hi, im trying to lern about raw sockets with my debian and c++. Tried to make a icmp and tcp packet and send it with sendto. Checked on wireshark and recognized that kernel changed my headers. So searched about stopping the kernel change the header and tried it with setsockopt, like said in at this... (4 Replies)
Discussion started by: sandcastle
4 Replies

9. Programming

Understanding Linux Kernel

Hi, I have started reading about Linux kernel. The books also explains about the source code here and there. I found a file named head.s in the source which i am not able to understand, it looks like some assembly language. Can anyone confirm this, so that can start looking for assemble... (3 Replies)
Discussion started by: kumaran_5555
3 Replies

10. Ubuntu

Kernel panics : trying to write / read on tiny tty driver

I'm a beginner to the Linux programming and trying my hands on some device driver examples while practising. The below code (a trimmed down version of tiny_tty.c from ldd3 book) loads perfectly using insmod and I'm able to see it in /proc/tty/drivers , /proc/modules and device nodes are getting... (1 Reply)
Discussion started by: diwsdiwa
1 Replies
ZZIP_DISK_MMAP(3)					       zziplib Function List						 ZZIP_DISK_MMAP(3)

NAME
zzip_disk_mmap, zzip_disk_init, zzip_disk_new, zzip_disk_munmap, zzip_disk_open, zzip_disk_buffer, zzip_disk_close - turn a filehandle into a mmapped zip disk archive handle SYNOPSIS
#include <zzip/mmapped.h> zzip__new__ ZZIP_DISK * zzip_disk_mmap((int fd)); int zzip_disk_init((ZZIP_DISK * disk, void *buffer, zzip_size_t buflen)); zzip__new__ ZZIP_DISK * zzip_disk_new((void)); int zzip_disk_munmap((ZZIP_DISK * disk)); zzip__new__ ZZIP_DISK * zzip_disk_open((char *filename)); zzip__new__ ZZIP_DISK * zzip_disk_buffer((void *buffer, size_t buflen)); int zzip_disk_close((ZZIP_DISK * disk)); DESCRIPTION
The zzip_disk_mmap function uses the given file-descriptor to detect the length of the file and calls the system mmap(2) to put it in main memory. If it is successful then a newly allocated ZZIP_DISK* is returned with disk->buffer pointing to the mapview of the zipdisk content. The zzip_disk_init function does primary initialization of a disk-buffer struct. The zzip_disk_new function allocates a new disk-buffer with malloc(3) The zzip_disk_munmap function is the inverse of zzip_disk_mmap and using the system munmap(2) on the buffer area and free(3) on the ZZIP_DISK structure. The zzip_disk_open function opens the given archive by name and turn the filehandle to zzip_disk_mmap for bringing it to main memory. If it can not be mmap(2)'ed then we slurp the whole file into a newly malloc(2)'ed memory block. Only if that fails too then we return null. Since handling of disk->buffer is ambigous it should not be snatched away please. The zzip_disk_buffer function will attach a buffer with a zip image that was acquired from another source than a file. Note that if zzip_disk_mmap fails then zzip_disk_open will fall back and try to read the full file to memory wrapping a ZZIP_DISK around the memory buffer just as the zzip_disk_buffer function will do. Note that the zzip_disk_buffer function will not own the buffer, it will neither be written nor free()d. The zzip_disk_close function will release all data needed to access a (mmapped) zip archive, including any malloc()ed blocks, sharedmem mappings and it dumps the handle struct as well. AUTHOR
o Guido Draheim <guidod@gmx.de> COPYRIGHT
Copyright (c) 2003,2004,2006 Guido Draheim All rights reserved, use under the restrictions of the Lesser GNU General Public License or alternatively the restrictions of the Mozilla Public License 1.1 zziplib 0.13.62 ZZIP_DISK_MMAP(3)
All times are GMT -4. The time now is 11:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy