EmbLogic's Blog

about ipc

Ipc mechanisms are mianly 5 types

1.pipes:it is related data only send from one pipe output is giving to another pipe input

to share resouses pipe are used

drawback:itis only related process only communicated

2.message queues:message queues are un related process are also communicate with message queues

drawback:user dont know which process curently works

share memory:memory shared in distributed systems some memory wants to share some files that time it is use full

semaphores
semaphore is integer type and in semaphore resourses give coding like negetive value means process are wants to use perticular resource waiting only

and 0 means no process is waiting

and 1 means one resource is free

and

sockets:sockets also ipc it is comunicate clients and server

with socket system calls connection oriented and connection less also

 


IPCs are
1.FIFO
2.Message Queue
3.Shared Memory
4.PIPE
5.Semaphore

we can also say the Sockets is one of the IPCs

 

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

What is the difference between Storage structure and file structure?

The representation of a particular data structure in the memory of a computer is called a storage structure whereas a storage structure representation in auxiliary memory is often called a file structure.

 

Posted in Data Structures with C | Leave a comment

DIFFERENCE BETWEEN NULL ARRAY AND EMPTY ARRAY

null array—-when the size of array is not declared than the array is known as null array.
EMPTY ARRAY——-if an array having the size but not values than it’s known as empty array.
EX =
null array b[];
empty array b[size of array];

Posted in Data Structures with C | Leave a comment

Creating pipes in C language

Creating “pipelines” with the C programming language can be a bit more involved than the simple shell example . To create a simple pipe with C, we make use of pipe(), open() and close() system calls. However there is a simpler way: the popen() function. The syntax is given below:

     FILE *popen ( char *command, char *type);

This standard library function creates a half-duplex pipeline by calling pipe() internally. It then forks a child process, exec the Bourne shell, and executes the “command” argument within the shell. Direction of data flow is determined by the second argument, “type”. It can be “r” or “w”, for “read” or “write”. It cannot be both! popen() returns the pointer to the new file stream or NULL on failure.

Pipes which are created with popen() must be closed with pclose(). popen() and pclose() share a striking resemblance to the standard file stream I/O functions fopen() and fclose().

     int pclose( FILE *stream );

The pclose() function performs a wait4() (waits for process termination) on the process forked by popen(). When it returns, it destroys the pipe and the file stream. Once again, it is synonymous with the fclose() function for normal stream-based file I/O. The pclose() returns wait4() status. If everything is all right it simply returns 0.

Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Introducation Interprocess Communication (IPC), Pipes

We have now began to see how multiple processes may be running on a machine and maybe be controlled (spawned by fork() by one of our programs.

In numerous applications there is clearly a need for these processes to communicate with each exchanging data or control information. There are a few methods which can accomplish this task. We will consider:

  • Pipes
  • Signals
  • Message Queues
  • Semaphores
  • Shared Memory
  • Sockets
Posted in Project 03: Client Server Communication using Linux and IPC | Leave a comment

Threads-using strcpy and analysing the result

RCS file: ./thread.c,v
Working file: ./thread.c
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
creating multiple threads using pthread_create()
joining the created multiple threads using pthread_join()
printing the no of threads created in the thread function
printing the message which is globally declared
—————————-
revision 1.2
date: 2014/06/03 07:04:12; author: root; state: Exp; lines: +1 -1
now using strcpy in the thread created
analysing the difference between the printing statements
—————————-
revision 1.1
date: 2014/06/03 07:03:50; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

Introduction To Threads

A thread of execution is often regarded as the smallest unit of processing that a scheduler works on.

A process can have multiple threads of execution which are executed asynchronously.

This asynchronous execution brings in the capability of each thread handling a particular work or service independently. Hence multiple threads running in a process handle their services which overall constitutes the complete capability of the process.

In this article we will touch base on the fundamentals of threads and build the basic understanding required to learn the practical aspects of Linux threads.

Why Threads are Required?

Now, one would ask why do we need multiple threads in a process?? Why can’t a process with only one (default) main thread be used in every situation.

Well, to answer this lets consider an example :

Suppose there is a process, that receiving real time inputs and corresponding to each input it has to produce a certain output. Now, if the process is not multi-threaded ie if the process does not involve multiple threads, then the whole processing in the process becomes synchronous. This means that the process takes an input processes it and produces an output.

The limitation in the above design is that the process cannot accept an input until its done processing the earlier one and in case processing an input takes longer than expected then accepting further inputs goes on hold.

To consider the impact of the above limitation, if we map the generic example above with a  socket server process that can accept input connection, process them and provide the socket client with output. Now, if in processing any input if the server process takes more than expected time and in the meantime another input (connection request) comes to the socket server then the server process would not be able to accept the new input connection as its already stuck in processing the old input connection. This may lead to a connection time out at the socket client which is not at all desired.

This shows that synchronous model of execution cannot be applied everywhere and hence was the requirement of asynchronous model of execution felt which is implemented by using threads.

Difference Between threads and processes

Following are some of the major differences between the thread and the processes :

  • Processes do not share their address space while threads executing under same process share the address space.
  • From the above point its clear that processes execute independent of each other and the synchronization between processes is taken care by kernel only while on the other hand the thread synchronization has to be taken care by the process under which the threads are executing
  • Context switching between threads is fast as compared to context switching between processes
  • The interaction between two processes is achieved only through the standard inter process communication while threads executing under the same process can communicate easily as they share most of the resources like memory, text segment etc

User threads Vs Kernel Threads

Threads can exist in user space as well as in kernel space.

A user space threads are created, controlled and destroyed using user space thread libraries. These threads are not known to kernel and hence kernel is nowhere involved in their processing. These threads follow co-operative multitasking where-in a thread releases CPU on its own wish ie the scheduler cannot preempt the thread. Th advantages of user space threads is that the switching between two threads does not involve much overhead and is generally very fast while on the negative side since these threads follow co-operative multitasking so if one thread gets block the whole process gets blocked.

A kernel space thread is created, controlled and destroyed by the kernel. For every thread that exists in user space there is a corresponding kernel thread. Since these threads are managed by kernel so they follow preemptive multitasking where-in the scheduler can preempt a thread in execution with a higher priority thread which is ready for execution. The major advantage of kernel threads is that even if one of the thread gets blocked the whole process is not blocked as kernel threads follow preemptive scheduling while on the negative side the context switch is not very fast as compared to user space threads.

If we talk of Linux then kernel threads are optimized to such an extent that they are considered better than user space threads and mostly used in all scenarios except where prime requirement is that of cooperative multitasking.

Problem with Threads

There are some major problems that arise while using threads :

  • Many operating system does not implement threads as processes rather they see threads as part of parent process. In this case, what would happen if a thread calls fork() or even worse what if a thread execs a new binary?? These scenarios may have dangerous consequences for example in the later problem the whole parent process could get replaced with the address space of the newly exec’d binary. This is not at all desired.  Linux which is POSIX complaint makes sure that calling a fork() duplicates only the thread that has called the fork() function while an exec from any of the thread would stop all the threads in the parent process.
  • Another problem that may arise is the concurrency problems. Since threads share all the segments (except the stack segment) and can be preempted at any stage by the scheduler than any global variable or data structure that can be left in inconsistent state by preemption of one thread could cause severe problems when the next high priority thread executes the same function and uses the same variables or data structures.

For the problem 1 mentioned above, all we can say is that its a design issue and design for applications should be done in a way that least problems of this kind arise.

For the problem 2 mentioned above, using locking mechanisms programmer can lock a chunk of code inside a function so that even if a context switch happens (when the function global variable and data structures were in inconsistent state) then also next thread is not able to execute the same code until the locked code block inside the function is unlocked by the previous thread (or the thread that acquired it

Posted in Uncategorized | Leave a comment

Thread

RCS file: thrd.c,v
Working file: thrd.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;     selected revisions: 1
description:
creating the thread
—————————-
revision 1.1    locked by: root;
date: 2014/06/03 06:37:40;  author: root;  state: Exp;
Initial revision
=============================================================================
RCS file: thrd.c,v
Working file: thrd.c
head: 1.1
branch:
locks: strict
root: 1.1
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;     selected revisions: 1
description:
creating the thread
—————————-
revision 1.1    locked by: root;
date: 2014/06/03 06:37:40;  author: root;  state: Exp;
Initial revision
=============================================================================
#include<stdio.h>
//#include<string.h>
#include<unistd.h>
#include<pthread.h>
//#include<sys/ipc.h>

void *thread_function(void *arg);
char mssg[]=”hi there”;
int main()
{
pthread_t var[20];
void *thrd_rslt;
int ret = pthread_create(&var[20],NULL,thread_function,(void *)mssg);
if(ret!=0)
{
perror(“creation failed”);
//              exit(EXIT_FAILURE);
return -1;
}
printf(” i got it……\n”);
printf(“thred created……\n”);
printf(“waiting for thread to finish………>>>>>>>\n”);
ret=pthread_join(var[20],&thrd_rslt);
if(ret!=0)
{
perror(“joining failed”);
//exit(EXIT_FAILURE);
return -1;
}
printf(“thread join returned %s\n”,(char *)thrd_rslt);
printf(“now message is %s\n”,mssg);
//exit(EXIT_SUCCESS);
return 0;
}
void *thread_function(void *arg)
{
printf(“thread function is running with arg %s\n”,(char*)arg);
sleep(2);
strcpy(mssg,”bye”);
pthread_exit(“thanks for cpu time>>>>>>>\n”);
}

Posted in Uncategorized | Leave a comment

a program of factorial using recursive function

description:
recursive function with factorial
—————————-
revision 1.1
date: 2014/06/02 06:36:43; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

Thread Creation and Joining the threads created.

RCS file: ./thread.c,v
Working file: ./thread.c
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;    selected revisions: 2
description:
pthread_create is used to create the thread
pthread_exit() is used in the thread created by the main function
pthread_join() is used to join the created thread to the main thread i.e.main function
—————————-
revision 1.2
date: 2014/06/03 04:12:49;  author: root;  state: Exp;  lines: +0 -1
now the array of thread is created by the main function
and also the array of the pthrea_join is used to join the threads created
—————————-
revision 1.1
date: 2014/06/03 04:11:14;  author: root;  state: Exp;
Initial revision
=============================================================================

Posted in Project 04: FTP based Client Server using Threads and Sockets | Leave a comment

DISK PARTITION

Primary Partition, Logical Partition and Extended Partition (Disk Partition Basic)

A disk partition is a defined storage space on a hard drive. All Windows operating systems can let users divide a hard disk into multiple partitions, in this way, making one physical hard disk into several smaller logical partitions. To store classified data, multiple partitions on a disk can organize his data more effectively. On Microsoft Windows system, the OS was installed in one partition and other some partition is created to store user data, documents or games. This benefit is when a problem occurs with Windows system; the OS partition can be totally destroyed and reinstalled, but this does not affect the data partition.

Some users may split a hard disk into multiple partitions because smaller partitions offer smaller cluster sizes. A cluster size is the smallest chunk of data which a partition can store. A large partition might have a cluster size of 64KB. This means that a file with one word in it will occupy 64KB of space on the disk. In a smaller partition, that file might only require 2KB to store. This is a useful policy if you need to save a large number of small files.

You can create, delete and format partition through using the diskpart.exe command. Many operating systems also have graphical tools which accomplish the same task such as Partition Assistant. The Partition Assistant is a free partition manager. It not only can partition on a disk, but also resize/move a partition to adjust the size of the partition to optimize disk space usage.
The following is Disk Partition Related Glossary

Primary Partition and Active Partition:
A primary partition is in which an Operating System can be installed. One hard disk may contain a maximum of 4 primary partitions. An active partition is based on primary partition. Any one of the 4 primary partitions can be set as active partition. Since there can be 4 primary partitions with 4 different Operating Systems installed, one of the partition that is marked active is used for the initial booting. The active partition contains the boot loader (such as ntldr or bootmgr) to load operating systems from a disk.

Extended Partition and Logical Partition:
Because the primary only can be created four maximum, this need to use extended partition to break the limitation of 4 partitions. In an Extended Partition you can create unlimited logical partition. You can store data in the logical partitions similar with primary partition, but the extended partition is not used to store data, because the Extended Partition is used to hold logical partitions, at the same time, there is one extended partition on a disk.

Partition Table:
Partition Table is a storage space which records some information about primary, extended and logical partitions. Further, the create/delete/resize of any partition all will modify the partition table to reflect the changes permanently. If partition table is crashed by virus or other stuffs, you partition will lost, so the table is extremely important.

Posted in Uncategorized | Leave a comment

What is Python?

Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python’s simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed.

Advantage:

1. Python code has to be strictly indented but the indentation helps in much cleaner code(readable).
2. High level data structures are list, directory are well suited in python. 
3. Easy to write, easy to read and easy to understand.

Example:

print '{0} and {1}'.format('spam', 'eggs')
Output=spam and eggs
Posted in Uncategorized | Leave a comment

an overview of how the system call in linux works

0) There is global system_call_table which has offsets of every system call
provided by the kernel (system call is just some function inside kernel). The global
means every process share the same system_call_table
1) User software prepares arguments of the system call, basically it puts them
to the CPU registers
2) User puts system call number to the appropriate CPU register (for example EAX)
3) User passes control to VDSO page
4) Code at this page executes either int $0×80 or syscall CPU instruction and generates
a special trap which is executed within kernel context.
5) The trap handler extracts the system call number from EAX and checks that it is good.
6) The trap handler prepares stack frame (put the values from register to stack)
7) The trap handler calls the code from the system_call_table using value extracted
at step 5 as an index in this table.
8) The system_call_table code returns back to the trap handler code, the trap hander
puts the returned value to the EAX and passes control back to the user space.

Posted in Linux Internals and System Programming | Leave a comment

Character driver (Problem in synchronization).

#problem persist in this as i required some synchronize technique because when i run multiple application onto the single node then data is to be in mingle form......do required semphore in this.....
RCS file: application3.c,v
Working file: application3.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
making the third application.
----------------------------
revision 1.1
date: 2014/05/30 09:20:55;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: cleanup.c,v
Working file: cleanup.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
this is used to remove and unregistered the module from the /proc/devices table.
----------------------------
revision 1.1
date: 2014/05/24 07:13:18;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devopen.c,v
Working file: devopen.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
open the module in the kernel layer by passing the argument from the application layer of the open system call.
here we are not using the trim funciton.
----------------------------
revision 1.1
date: 2014/05/24 07:15:18;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devwrite.c,v
Working file: devwrite.c
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;	selected revisions: 3
description:
used to write in the multiple quantum
multiple qset
then use copy_from_user.
very important file and hard too.
----------------------------
revision 1.3
date: 2014/05/25 09:31:31;  author: root;  state: Exp;  lines: +11 -4
use the loff and filep->f_pos to see the position of the pointer.
this loff and filep->f_pos could not be updated automatically so we make the updation.
----------------------------
revision 1.2
date: 2014/05/24 07:47:23;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2014/05/24 07:17:56;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: header.h,v
Working file: header.h
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
define macros and include header file in this and make a ScullDev and ScullQset structure in this.
----------------------------
revision 1.1
date: 2014/05/24 07:11:00;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: prototype.h,v
Working file: prototype.h
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;	selected revisions: 3
description:
declare the prototype.
----------------------------
revision 1.3
date: 2014/05/25 11:29:17;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
----------------------------
revision 1.2
date: 2014/05/24 09:07:02;  author: root;  state: Exp;  lines: +2 -0
mention the prototype of the read call which is is fs.h header file and is in the struct file_operations {
----------------------------
revision 1.1
date: 2014/05/24 07:14:52;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: application4.c,v
Working file: application4.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
making the fourth application.
----------------------------
revision 1.1
date: 2014/05/30 09:21:09;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: declaration.h,v
Working file: declaration.h
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
define some macros which are freq	uently used in our program.
----------------------------
revision 1.1
date: 2014/05/24 07:14:06;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devread.c,v
Working file: devread.c
head: 1.10
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 10;	selected revisions: 10
description:
write the fuction for the read which is work in the kernel layer.
----------------------------
revision 1.10
date: 2014/05/30 07:09:09;  author: root;  state: Exp;  lines: +13 -8
implement the SEEK_SET again.
and it work file
----------------------------
revision 1.9
date: 2014/05/26 11:19:45;  author: root;  state: Exp;  lines: +28 -9
draw logic for the seek operation.
----------------------------
revision 1.8
date: 2014/05/24 11:40:26;  author: root;  state: Exp;  lines: +9 -5
give the defination for the read function.
----------------------------
revision 1.7
date: 2014/05/24 10:34:09;  author: root;  state: Exp;  lines: +7 -2
*** empty log message ***
----------------------------
revision 1.6
date: 2014/05/24 09:28:15;  author: root;  state: Exp;  lines: +5 -5
*** empty log message ***
----------------------------
revision 1.5
date: 2014/05/24 09:26:24;  author: root;  state: Exp;  lines: +7 -7
*** empty log message ***
----------------------------
revision 1.4
date: 2014/05/24 09:21:09;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.3
date: 2014/05/24 09:19:17;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.2
date: 2014/05/24 09:16:07;  author: root;  state: Exp;  lines: +1 -0
make a access to the private data to the sculldev
----------------------------
revision 1.1
date: 2014/05/24 09:09:26;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: init.c,v
Working file: init.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
this is used to insert the module the register the module.
in this i dont use trim function.
----------------------------
revision 1.1
date: 2014/05/24 07:12:20;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: application2.c,v
Working file: application2.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
this is the application2.
here we are using the single node to exess the two application.
----------------------------
revision 1.1
date: 2014/05/30 07:55:15;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: application.c,v
Working file: application.c
head: 1.16
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 16;	selected revisions: 16
description:
this is the application program in the user space
open write and close is used
----------------------------
revision 1.16
date: 2014/05/30 07:19:57;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.15
date: 2014/05/30 07:09:07;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.14
date: 2014/05/29 06:06:43;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.13
date: 2014/05/29 06:05:10;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.12
date: 2014/05/29 05:44:00;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.11
date: 2014/05/29 05:43:01;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.10
date: 2014/05/29 05:38:44;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.9
date: 2014/05/29 05:37:02;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.8
date: 2014/05/26 11:19:01;  author: root;  state: Exp;  lines: +2 -2
seeking operation applied
apply SEEK_SET. and call lseek in application layer
----------------------------
revision 1.7
date: 2014/05/26 06:00:53;  author: root;  state: Exp;  lines: +10 -4
not open the node in RDWR mode because the node either open in the WR mode or in RD mode because its tbecause if we make it fullduplex then data get mingle.
----------------------------
revision 1.6
date: 2014/05/25 11:29:25;  author: root;  state: Exp;  lines: +11 -7
open the file in the O_RDWR mode then its capable to read and write from the files.
----------------------------
revision 1.5
date: 2014/05/24 11:49:01;  author: root;  state: Exp;  lines: +9 -9
*** empty log message ***
----------------------------
revision 1.4
date: 2014/05/24 11:35:56;  author: root;  state: Exp;  lines: +12 -12
close the fd for the writing then open it again in the read mode.
----------------------------
revision 1.3
date: 2014/05/24 09:07:54;  author: root;  state: Exp;  lines: +16 -2
close the fd for the write operation(important to close the fd otherwise use lseek)
then open in the read mode then read
 while using its file descriptor.
----------------------------
revision 1.2
date: 2014/05/24 07:49:26;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2014/05/24 07:17:20;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devlseek.c,v
Working file: devlseek.c
head: 1.2
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;	selected revisions: 2
description:
----------------------------
revision 1.2
date: 2014/05/30 07:09:37;  author: root;  state: Exp;  lines: +4 -2
*** empty log message ***
----------------------------
revision 1.1
date: 2014/05/25 11:30:12;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devrelease.c,v
Working file: devrelease.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
for closeing the module
----------------------------
revision 1.1
date: 2014/05/24 07:16:45;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: fileopr.h,v
Working file: fileopr.h
head: 1.3
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 3;	selected revisions: 3
description:
used for the mapping purpose.
----------------------------
revision 1.3
date: 2014/05/25 11:30:20;  author: root;  state: Exp;  lines: +2 -1
*** empty log message ***
----------------------------
revision 1.2
date: 2014/05/24 09:09:56;  author: root;  state: Exp;  lines: +2 -1
do the mapping of read
----------------------------
revision 1.1
date: 2014/05/24 07:18:55;  author: root;  state: Exp;
Initial revision
=============================================================================
Posted in Uncategorized | Leave a comment

Linux Filesystem Hierarchy.

/bin: it usually contains the shells like bash, csh, etc…. and commonly used commands like cp, mv, rm, cat, ls. For this reason and in contrast to /usr/bin, the binaries in this directory are considered to be essential. The reason for this is that it contains essential system programs
that must be available even if only the partition containing / is mounted.

/boot: This directory contains everything required for the boot process except for configuration files not needed at boot time and the map installer.Thus, the /boot directory stores data that is used before the kernel begins executing user?mode programs.

/dev : /dev is the location of special or device files.It is a very interesting directory that highlights one important aspect of the Linux filesystem ? everything is a file or a directory.
/etc: This is the nerve center of your system, it contains all system related configuration files in here or in its sub?directories. A “configuration file” is defined as a local file used to control the operation of a program; it must be static and cannot be an executable binary.

/home: Linux is a multi?user environment so each user is also assigned a specific directory that is accessible only to them and the system administrator. These are the user home directories, which can be found under’/home/$USER’ (~/).home directory contains personal configuration files, the so?called dot files. Personal configuration files are usually ‘hidden’, if we want to see them,we either have to turn on the appropriate option in our file manager or run ls with the ?a switch. If there is a
conflict between personal and system wide configuration files, the settings in the personal file will prevail.

/initrd: initrd provides the capability to load a RAM disk by the boot loader. This RAM disk can then be mounted as the root file system and programs can be run from it. Afterwards, a new root file system can be mounted from a different device. The previous root (from initrd) is then moved to a directory and can be subsequently unmounted.initrd is mainly designed to allow system startup to occur in two phases, where the kernel comes up with a minimum set of compiled?in drivers, and where additional modules are loaded from initrd.

/lib: The /lib directory contains kernel modules and those shared library images needed to boot the system and run the commands in the root filesystem, ie. by binaries in /bin and /sbin.Libraries are readily identifiable through their filename extension of *.

/media: This directory contains subdirectories which are used as mount points for removeable media such as floppy disks, cdroms and zip disks.The motivation for the creation of this directory has been that historically there have been a number of other different places used to mount removeable
media such as /cdrom, /mnt or /mnt/cdrom.

/mnt: This is a generic mount point under which you mount your filesystems or devices. Mounting is the process by which we make a filesystem available to the system. After mounting our files will be accessible under the mount?point. This directory usually contains mount points or sub?directories where we mount our floppy and our CD. we can also create additional mount?points here if we wish. Standard mount points would include /mnt/cdrom and /mnt/floppy. There is no limitation to creating a mount?point anywhere on our system. It should be noted that some distributions like Debian allocate /floppy and /cdrom as mount points while Redhat and Mandrake puts them in /mnt/floppy and /mnt/cdrom respectively.

/opt: This directory is reserved for all the software and add?on packages that are not part of the default installation. Any package to be installed here must locate its static files (ie. extra fonts, clipart, database files) must locate its static files in a separate /opt/’package’ or /opt/’provider’ directory tree.Generally, all data required to support a package on a system must be present within /opt/’package’, including files intended to be copied into /etc/opt/’package’ and /var/opt/’package’ as well as reserved directories in /opt.

/proc: /proc is very special in that it is also a virtual filesystem. It’s sometimes referred to as a process information pseudo?file system. It doesn’t contain ‘real’ files but runtime system information (e.g. system memory, devices mounted, hardware configuration, etc). For this reason it can be regarded as a control and information centre for the kernel. In fact, quite a lot of system utilities are simply calls to files in this directory.
For example,’lsmod’ is the same as ‘cat /proc/modules’ while ‘lspci’ is a synonym for ‘cat /proc/pci’.
By altering files located in this directory we can even read/change kernel parameters (sysctl) while the system is running.

/root: This is the home directory of the System Administrator, ‘root’. This may be somewhat confusing (‘root on root’) but in former days, ‘/’ was root’s home directory (hence the name of the Administrator account). To keep things tidier, ‘root’ got his own home directory.

/sbin: Linux discriminates between ‘normal’ executables and those used for system maintenance and/or
administrative tasks. The latter reside either here or ? the less important ones ? in /usr/sbin. Locally installed system administration programs should be placed into /usr/local/sbin. Programs executed after /usr is known to be mounted (when there are no problems) are generally placed into /usr/sbin. This directory contains binaries that are essential to the working of the system. These include system administration as well as maintenance and hardware configuration program.we may find lilo, fdisk,init, ifconfig, etc…. here.

/usr: /usr usually contains by far the largest share of data on a system. Hence, this is one of the most important directories in the system as it contains all the user binaries, their documentation, libraries, header files, etc…. X and its supporting libraries can be found here. User programs like telnet, ftp, etc…. are also placed here.

/var: Contains variable data like system logging files, mail and printer spool directories, and transient and temporary files. Some portions of /var are not shareable between different systems. For instance, /var/log, /var/lock, and /var/run. Other portions may be shared, notably /var/mail, /var/cache/man, /var/cache/fonts, and /var/spool/news.’/var’ contains variable data, i.e. files and
directories the system must be able to write to during operation, whereas /usr should only contain static data.

/srv: /srv contains site?specific data which is served by this system. This main purpose of specifying this is so that users may find the location of the data files for particular service, and so that services which require a single tree for readonly data, writable datand scripts can be reasonably placed. Data that is only of interest to a specific user should go in that users’
home directory.

/tmp: This directory contains mostly files that are required temporarily. Many programs use this to create lock files and for temporary storage of data. Many these files are important for currently running programs. and deleting them may result in a system crash. Usually it won’t contain more than a few KB anyway. On most systems, this directory is cleared out at boot or at shutdown by the local system

Posted in Uncategorized | Leave a comment