EmbLogic's Blog

Difference Between printf() and scanf() in C

printf():

  • When printf() is used in a progam,that means whatever statement we want to print on the shell will be written inside the double codes i.e printf(“hello”).
  • If we write printf(“Hello\n”) then \n means when Hello is printed on the shell then cursor will move to the very next line of the shell.
  • Another eg is if we have already assigned a value to a variable i.e int a=7,and we want to printf the value of a using printf(),we will write as printf(“value of a=%d”,a); Here %d means assigning the very next integer.And it will print as “value of a=7″ on the shell.And there is no need to give the address.
  • printf() returns the number of bytes written succesfully.

scanf():

  • If we want that the user will enter some value then we use scanf().For eg scanf(“%d”,&a),here address is given in the scanf() so that some address is allocated to the integer.
  • scanf() does not return anything.

 

Posted in Data Structures with C | Leave a comment

SHARED MEMORY

Shared memory allows one or more processes to communicate via memory that appears in all of their virtual address spaces. The pages of the virtual memory is referenced by page table entries in each of the sharing processes’ page tables. It does not have to be at the same address in all of the processes’ virtual memory. As with all System V IPC objects, access to shared memory areas is controlled via keys and access rights checking. Once the memory is being shared, there are no checks on how the processes use it. They must rely on other mechanisms, for example System V semaphores, to synchronize access to the memory.

System V IPC Shared Memory

Each newly created shared memory area is represented by a shmid_ds data structure. These are kept in the shm_segs vector.

The shmid_ds data structure decribes how big the area of shared memory is, how many processes are using it and information about how that shared memory is mapped into their address spaces. It is the creator of the shared memory that controls the access permissions to that memory and whether its key is public or private. If it has enough access rights it may also lock the shared memory into physical memory.

Each process that wishes to share the memory must attach to that virtual memory via a system call. This creates a newvm_area_struct data structure describing the shared memory for this process. The process can choose where in its virtual address space the shared memory goes or it can let Linux choose a free area large enough. The new vm_area_struct structure is put into the list of vm_area_struct pointed at by the shmid_ds. The vm_next_shared and vm_prev_shared pointers are used to link them together. The virtual memory is not actually created during the attachment; it happens when the first process attempts to access it.

The first time that a process accesses one of the pages of the shared virtual memory, a page fault will occur. When Linux fixes up that page fault it finds the vm_area_struct data structure describing it. This contains pointers to handler routines for this type of shared virtual memory. The shared memory page fault handling code looks in the list of page table entries for this shmid_ds to see if one exists for this page of the shared virtual memory. If it does not exist, it will allocate a physical page and create a page table entry for it.

This entry is saved in the current process’ page tables and the shmid_ds.. Consequently, when the next process that attempts to access this memory gets a page fault, the shared memory fault handling code will use this newly created physical page for that process too. So, the first process that accesses a page of the shared memory causes it to be created and thereafter access by the other processes cause that page to be added into their virtual address spaces.

When processes no longer wish to share the virtual memory, they detach from it. So long as other processes are still using the memory the detach only affects the current process. Its vm_area_struct is removed from the shmid_ds data structure and deallocated. The current process’s page tables are updated to invalidate the area of virtual memory that it once shared. When the last process sharing the memory detaches from it, the pages of the shared memory current in physical memory are freed, as is theshmid_ds data structure for this shared memory.

Posted in Uncategorized | Leave a comment

Memset,Memmove,Memcopy Function

The memset() Function

To set all the bytes in a block of memory to a particular value, use memset(). The function prototype is

void * memset(void *dest, int c, size_t count);

The argument dest points to the block of memory. c is the value to set, and count is the number of bytes, starting at dest, to be set. Note that while c is a type int, it is treated as a type char. In other words, only the low-order byte is used, and you can specify values of c only in the range 0 through 255.

Use memset() to initialize a block of memory to a specified value. Because this function can use only a type char as the initialization value, it is not useful for working with blocks of data types other than type char, except when you want to initialize to 0. In other words, it wouldn’t be efficient to use memset() to initialize an array of type int to the value 99, but you could initialize all array elements to the value 0.

The memcpy() Function

memcpy() copies bytes of data between memory blocks, sometimes called buffers. This function doesn’t care about the type of data being copied–it simply makes an exact byte-for-byte copy. The function prototype is

void *memcpy(void *dest, void *src, size_t count);

The arguments dest and src point to the destination and source memory blocks, respectively. count specifies the number of bytes to be copied. The return value is dest. If the two blocks of memory overlap, the function might not operate properly–some of the data in src might be overwritten before being copied.

The memmove() Function

memmove() is very much like memcpy(), copying a specified number of bytes from one memory block to another. It’s more flexible, however, because it can handle overlapping memory blocks properly. Because memmove() can do everything memcpy() can do with the added flexibility of dealing with overlapping blocks. The prototype is

void *memmove(void *dest, void *src, size_t count);

dest and src point to the destination and source memory blocks, and count specifies the number of bytes to be copied. The return value is dest. If the blocks overlap, this function ensures that the source data in the overlapped region is copied before being overwritten.

Posted in Project 11: A Character Device Drivers Based Project | Leave a comment

FIFO-done with three clients

RCS file: req_client_1.c,v
Working file: req_client_1.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
sending the data to the server
on the request of server’s availability
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:08:52; author: root; state: Exp; lines: +0 -1
recieving the result from the server successfully
—————————-
revision 1.1
date: 2014/05/21 15:07:20; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: req_client_2.c,v
Working file: req_client_2.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
sending the data to the server
on recieving the availability of the server
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:09:16; author: root; state: Exp; lines: +1 -0
recieving the result from the server successfully
—————————-
revision 1.1
date: 2014/05/21 15:07:20; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: req_client_3.c,v
Working file: req_client_3.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
sending the data to the server
on recieving the avialaibility of the server
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:09:33; author: root; state: Exp; lines: +1 -0
recieving the result from the server successfully
—————————-
revision 1.1
date: 2014/05/21 15:07:20; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: server.c,v
Working file: server.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
sending the request to different requesting clients
to send the data to the server
recieving the data from diffrerent users
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:09:54; author: root; state: Exp; lines: +1 -0
recieved data from the re_clients and
gave the data to processing_clients and
recieved the result from different processing clients
transfer the result to the respective requsting clients
—————————-
revision 1.1
date: 2014/05/21 15:07:21; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: adder.c,v
Working file: adder.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
recieving the data from the server and performing
addition operation
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:11:22; author: root; state: Exp; lines: +2 -1
gave back the result to the server successfully
—————————-
revision 1.1
date: 2014/05/21 15:07:21; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: subtractor.c,v
Working file: subtractor.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
recieving the data from the server and
performing subtraction operation
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:11:40; author: root; state: Exp; lines: +1 -0
gave the result back to the server successfully
—————————-
revision 1.1
date: 2014/05/21 15:07:21; author: root; state: Exp;
Initial revision
=============================================================================

RCS file: multiplier.c,v
Working file: multiplier.c
head: 1.2
branch:
locks: strict
root: 1.2
access list:
symbolic names:
keyword substitution: kv
total revisions: 2; selected revisions: 2
description:
recieving the data from the server and
performing the multiplication operation
—————————-
revision 1.2 locked by: root;
date: 2014/05/21 15:11:55; author: root; state: Exp; lines: +1 -0
gace the result to the server successfully
—————————-
revision 1.1
date: 2014/05/21 15:07:21; author: root; state: Exp;
Initial revision
=============================================================================

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

Character driver-sucessfully working for min 32 distinct user

The code is working fine for 32 distinct user acessing 2 nodes node0 and node1
ie, 32 user can acess this driver at a time without reporting a bug.
there are 2 operation that i perform for each application
1.write to scull
2.read from scull without closing fd in the same application

As the same application is acessing the driver by different user using node0 and node1
so in write operation the same memory segment is owerwrite by the different user and read viceversa
the starting address of the device is fixed
if we close the fd after write operation then again open the skull in RDONLY mode the old fd was lost and stream got closed and while reading it will read the last written text in the quantum of the skull.

rlog: RCS/write,v: No such file or directory
[root@rahul basic]# rlog ./write.c

RCS file: ./write.c,v
Working file: ./write.c
head: 1.105
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 105; selected revisions: 105
description:
this is the file for user write like operation
—————————-
revision 1.105
date: 2014/05/19 20:18:45; author: root; state: Exp; lines: +7 -0
printing llseek pointer value and update at th end
—————————-
revision 1.104
date: 2014/05/19 19:29:42; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.103
date: 2014/05/19 19:26:32; author: root; state: Exp; lines: +7 -7
quantum and qset different way of accessing
—————————-
revision 1.102
date: 2014/05/19 19:06:19; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.101
date: 2014/05/19 19:05:23; author: root; state: Exp; lines: +2 -5
*** empty log message ***
—————————-
revision 1.100
date: 2014/05/19 19:04:27; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.99
date: 2014/05/19 19:03:29; author: root; state: Exp; lines: +7 -0
printing quantum_size and qset_size
—————————-
revision 1.98
date: 2014/05/19 18:56:11; author: root; state: Exp; lines: +3 -0
*** empty log message ***
—————————-
revision 1.97
date: 2014/05/19 18:51:13; author: root; state: Exp; lines: +7 -11
*** empty log message ***
—————————-
revision 1.96
date: 2014/05/19 18:41:22; author: root; state: Exp; lines: +1 -0
*** empty log message ***
—————————-
revision 1.95
date: 2014/05/19 18:37:49; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.94
date: 2014/05/19 18:36:58; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.93
date: 2014/05/19 18:35:12; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.92
date: 2014/05/19 18:34:24; author: root; state: Exp; lines: +8 -6
*** empty log message ***
—————————-
revision 1.91
date: 2014/05/19 18:26:53; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.90
date: 2014/05/19 18:24:01; author: root; state: Exp; lines: +0 -1
*** empty log message ***
—————————-
revision 1.89
date: 2014/05/19 18:04:33; author: root; state: Exp; lines: +4 -3
reallocation qset_size to qset and quantum_size to quantum
—————————-
revision 1.88
date: 2014/05/19 05:45:58; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.87
date: 2014/05/19 05:36:01; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.86
date: 2014/05/19 05:33:44; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.85
date: 2014/05/19 05:31:13; author: root; state: Exp; lines: +1 -3
*** empty log message ***
—————————-
revision 1.84
date: 2014/05/19 05:30:02; author: root; state: Exp; lines: +0 -2
*** empty log message ***
—————————-
revision 1.83
date: 2014/05/19 04:19:02; author: root; state: Exp; lines: +1 -1
set location of label loop
—————————-
revision 1.82
date: 2014/05/18 19:57:16; author: root; state: Exp; lines: +1 -1
location of label loop changed
—————————-
revision 1.81
date: 2014/05/16 12:53:09; author: root; state: Exp; lines: +1 -1
successful working for multiple quantum,multiple QSETS and scullqsets
—————————-
revision 1.80
date: 2014/05/16 08:37:31; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.79
date: 2014/05/16 08:35:54; author: root; state: Exp; lines: +2 -2
testing
—————————-
revision 1.78
date: 2014/05/16 08:34:38; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.77
date: 2014/05/16 08:29:37; author: root; state: Exp; lines: +1 -1
*** empty log message ***
////////////////////////////////////////////////////////////////////////////////////////////////

RCS file: ./header.h,v
Working file: ./header.h
head: 1.65
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 65; selected revisions: 65
description:
this is the initial header file
—————————-
revision 1.65
date: 2014/05/19 20:18:21; author: root; state: Exp; lines: +1 -0
give prototype of llseek mapped to scullseek
—————————-
revision 1.64
date: 2014/05/19 19:27:36; author: root; state: Exp; lines: +2 -2
changing prototypes of allocate_quantum and allocate_qset
—————————-
revision 1.63
date: 2014/05/19 19:03:22; author: root; state: Exp; lines: +0 -2
*** empty log message ***
—————————-
revision 1.62
date: 2014/05/19 18:59:34; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.61
date: 2014/05/19 18:58:52; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.60
date: 2014/05/19 18:58:20; author: root; state: Exp; lines: +2 -2
*** empty log message ***
—————————-
revision 1.59
date: 2014/05/19 18:56:10; author: root; state: Exp; lines: +3 -3
*** empty log message ***
—————————-
revision 1.58
date: 2014/05/19 18:51:12; author: root; state: Exp; lines: +6 -0
*** empty log message ***
—————————-
revision 1.57
date: 2014/05/19 18:29:05; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.56
date: 2014/05/19 18:04:01; author: root; state: Exp; lines: +0 -15
delete macros QUANTUM_SIZE,QSET_SIZE,DEVICE_SIZE
—————————-
revision 1.55
date: 2014/05/13 09:04:02; author: root; state: Exp; lines: +1 -0
included header file for copy_from_user asm-generic/uaccess.h
—————————-
revision 1.54
date: 2014/05/12 10:34:53; author: root; state: Exp; lines: +1 -1
allocate_quantum(void)
—————————-
revision 1.53
date: 2014/05/12 10:25:01; author: root; state: Exp; lines: +1 -0
included allocate_quantum()
—————————-
revision 1.52
date: 2014/05/12 09:56:40; author: root; state: Exp; lines: +1 -0
included allocate skullqset
—————————-
revision 1.51
/////////////////////////////////////////////////////////////////////////////////////////////////////////RCS file: ./scullseek.c,v
Working file: ./scullseek.c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 1
description:
this is the initial file for llseek system call
—————————-
revision 1.1
date: 2014/05/19 20:22:58; author: root; state: Exp;
Initial revision
////////////////////////////////////////////////////////////////////////////////////////////////////
RCS file: ./init.c,v
Working file: ./init.c
head: 1.68
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 68; selected revisions: 68
description:
this is the initial file contain initialize function
—————————-
revision 1.68
date: 2014/05/19 20:18:14; author: root; state: Exp; lines: +2 -1
*** empty log message ***
—————————-
revision 1.67
date: 2014/05/19 18:03:18; author: root; state: Exp; lines: +7 -5
module_param qset_size,quantum_size,device_size all set in the sculldev structure.
—————————-
revision 1.66
date: 2014/05/19 17:44:58; author: root; state: Exp; lines: +2 -1
using param for n variable
—————————-
revision 1.65
date: 2014/05/19 17:35:37; author: root; state: Exp; lines: +2 -2
module_param n
—————————-
revision 1.64
date: 2014/05/10 07:09:08; author: root; state: Exp; lines: +4 -4
*** empty log message ***
—————————-
revision 1.63
date: 2014/05/10 06:52:55; author: root; state: Exp; lines: +10 -0
allocate parameters of skulldev and assign values to them
—————————-
revision 1.62
date: 2014/05/09 09:31:15; author: root; state: Exp; lines: +1 -1
*** empty log message ***
—————————-
revision 1.61
date: 2014/05/09 09:28:39; author: root; state: Exp; lines: +2 -1
included read
—————————-
revision 1.60
date: 2014/05/08 07:36:24; author: root; state: Exp; lines: +1 -1
struct Sculldev *sculldev to struct ScullDev *sculldev
—————————-
revision 1.59
/////////////////////////////////////////////////////////////////////////////////////

Posted in Character Driver | Leave a comment

message queue impliment for one client

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment    @ * @;

1.1
date    2014.05.20.09.09.51;    author root;    state Exp;
branches;
next    ;

desc
@message rcv for comm..
@

1.1
log
@Initial revision
@
text

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment    @ * @;

1.1
date    2014.05.20.09.08.27;    author root;    state Exp;
branches;
next    ;

desc
@message queue impliment.
@

1.1
log
@Initial revision
@
text

Posted in Uncategorized | Leave a comment

silly warnings

“ISO C90 warning”

arises bcoz in your function you are defining variables in b/w the statements….correct method is you define and declare varibles at beginning of the function only……

Posted in Uncategorized | Leave a comment

character driver—>devwrite.c

Major reasons for kernel Crash

1>>you trying to access a location in kernel space which you are not authorised.

2>>you are trying to write data in the memory location which is not part of quantums(***MAJOR CRASH***).

 

Posted in Character Driver, Device Drivers | Leave a comment

linux OS…Why so important

Why Linux is the Best Operation System

Welcome To LinuxShark,

LinuxShark is based on OpenSuSE, With the award winning GNOME Desktop (option to add KDE avaliable) .

Updated regularly with the latest security patches and kernel builds. Keeping you safe all the time !

What More ??… Download LinuxShark Today And Explore !

For non-techie computer users, choosing the best operating system can be a daunting, if not frustrating, exercise. How do you choose between the obvious options Windows 7 and Mac OS X? Better yet, how does Linux stack up against these popular options? More to the point, why are many computer experts touting the versatility and robustness of Linux over the more mainstream Windows and Mac? Could it really be possible that while Windows and Mac OS X lead in terms of popularity among the non-computer experts, Linux has quietly grabbed the distinction as the best operating system out in the market?

In this post, we will talk about the main features of Linux with the added explanation as to why experts indeed consider it as the best operating system available. You’d be surprised to know the limitations of Windows 7 and Mac OS X and how Linux adequately meets these limitations without compromising its ability to match the expected functions of the more established brands.

The best feature of Linux operating systems is its low susceptibility to virus and malware infestation. If you have been a Windows user for a long time, you would know how problematic Windows is when it comes to viruses. With Linux, you are spared from all the hassle of having to constantly update your anti-virus software or scan your computer every so often.

Linux is almost always a free operating system with multiple sources distribution. In contrast, Windows and Mac OS X are some of the most expensive operating systems available. If you want to cut on costs, you can definitely benefit from choosing Linux for your everyday needs.

Linux is an open source platforms with plenty of developers working on applications, functions, features and add-ons that are guaranteed to improve your user experience. Contrary to popular belief, many Linux functions rival those of Windows and Mac OS. All that you need to do is try it out for a couple of weeks to personally see for yourself how Linux is so much better than many perceive it to be.

One of the most important reasons why computer-savvy individuals consider Linux as the best operating system is because it is far more customizable than its popular counterparts. With Windows and Mac, there are plenty of restrictions that limit what you can do to the OS. This is not easily noticeable to the average computer user but if you are planning to do plenty of customizations, Linux is undoubtedly the best operating system for this purpose.
If you do not want to ditch your Windows applications but would want to give Linux a try, there are many compatibility programs that allow Linux to run Windows programs like Word, Excel, and PowerPoint. You can run programs like Wine to load Microsoft Office programs and still enjoy the many benefits of Linux as the underlying operating system.

Low resource requirements. Ever notice how Windows hangs up after a few years of use? As your computer gets older, it demands more resources such as RAM eventually slowing down your system. With Linux’s low-resource approach, you are less likely to encounter slower load times.

These reasons highlight the versatility and strength of Linux operating systems and easily explain why it is the best operating system on the market. Give it a shot and find out for yourself how Linux can make your life so much simpler without altering your computer usage habits and undermining your computer’s performance.

Why Did Dell Just Launch A Line of Linux Laptops?

Actually what you may not know is that Dell has actually been selling Linux laptops since 2007, but stopped marketing them when their general users found Linux too difficult to use.

Even though they stopped the promotion of Linux machines, plenty were still being sold around the globe and now they are back due to popular demand. Dell does say that their marketing efforts will clearly states these Linux machines are for power users only.

Linux has been around for a number of years with many users swearing by the operating system, those that are used to Windows machines often find Ubuntu very difficult to lose, much like when you try to lose weight, it feels impossible but once you get into the rhythm of healthy eating the weight drops off.

This operating system is exceptionally versatile, enabling users with computer knowledge to tailor it to their specific needs, there are thousands of forums online with suggestions and help, and you find them the same way you would if you were to search for Gibson les Paul or phen375 reviews.

Dell has also set up an information section on their website to help users come to grips with the Linux system. The Dell laptops will not offer dual booting, which means you cannot have Windows running, but they will accommodation a Windows version of the operating system, you can visit website to find out more.

What Makes Linux So Popular?

Besides demand, Dell has chosen to use Linux on their machines because the software is so affordable, this means lower priced laptops to the public. The machines will be able to run faster and smoother than they do with Windows with less frustrating updates.

Linux offers a choice of benefits from affordability and flexibility to excellent packages including word processing, spreadsheets and more.

Once you get the hang of the Linux program it is really easy to use, those that have been using it for years will tell you it far outweighs Windows, but for Windows users it’s a little more complicated than that.

Linux machines enable you to ensure excellent reputation management online by tailoring your operating system to meet your specific demands. You can find out more information on these machines when you click for source.

Overall it has to be agreed that demand has brought these great operating system back to the Dell laptops, they couldn’t ignore the fact that their Linux machines were still selling and in high demand, yet they were not advertising them anymore, actually they stopped advertising them back in 2010 and yet they were still selling.

In order to keep up with the times, Dell has had to take the client demands into consideration before losing the power user side of the market. The same as you can test an example url, but it’s no use if you don’t have the specific target audience clicking on it.

It will be exciting to see how these new Linux Dell Laptops do and how well they sell once they are introduced onto the market.

Is Linux Right For You?

When you purchase a new computer these days you have choices on whether to go with the system on the machine or sold separately which can cost a small fortune or to go for Linux.

Now the one thing you need to realize is that initially you will struggle to find your way around Linux, especially if you are used to using Windows, but there are some advantages of Linux that may help you determine whether it is the right operating system for you.

Affordable

If you’re basing your decision on price, then Linux is right for you. There is no comparing Windows to Linux when it comes to money; we all know that Windows is expensive, while Linux can be obtained free, a huge cost saving in anyone’s book. All you have to do is go to the webpage and click where it says click here and you have Linux ready to go.

Security

Another known fact about Linux is their security is much stronger than other operating systems; you don’t need home security systems for your computer when you use the Linux system, and you can browse the net without any serious concerns.

Versatility

The biggest plus for me when it comes to Linux is the ability for me to change what I want and how I want it especially on my desktop, the versatility is easy and amazing and I’m not forced to go with the design given to me. It’s similar to when you are shopping around for remodeling estimates, but you know exactly what you want and don’t need someone deciding for you.

Fast and Efficient

Another interesting fact about Linux is how fast and effective it is, it’s the ideal solution for an older computer which struggles with other operating systems, it is much faster is start up to browsing. It’s like the hcg drops you buy when trying to lose weight, super-fast and super effective, you can think of it as the anti wrinkle cream for older computers to get them running smoothly again.

What Else You Need To Know

Now it is true that when you load Linux onto a machine for the first time you may find it difficult to navigate and get around, this is because it’s something new, something you’re not used to. Once you get the hang of it, it can be very rewarding and offer you many features and benefits you never dreamed possible.

Think of Linux as umbrella companies, they come in to protect and help you when other operating systems fail. You don’t need a digital agency to help you operate your computer and it’s not as hard a work as a pullup bar in the gym.

You need to also take into account that Linux comes with a choice of bundled software including their own word-processing and spreadsheet programs, so you can still do everything you used to do before. Easy and fast internet search engines where you can easily search for San Marcos Flooring or ACN-INC without any problems.

Why Linux is a Great Operating System

When you get a new computer you have such a selection of operating systems to choose from. There is Windows, MAC and then Linux. Linux tends to be the more popular and has been voted the best operating system, but why?

Firstly Linux is affordable, often it’s completely free. This is a huge draw card for many people. The other operating systems are expensive and they also tend to suffer with viruses and constant updates, which are frustrating to say the least. You don’t need a finance mba online degree to know that finding a free operating system is a huge saving, especially when you have just paid out for a new PC.

Posted in Uncategorized | Leave a comment

About fork()

Fork is an operation whereby a process creates a copy of itself. It is usually a system call, implemented in the kernel. Fork is the primary (and historically, only) method of process creation on Unix-like operation. In multitasking operating systems, processes (running programs) need a way to create new processes, e.g. to run other programs.Fork and its variants are typically the only way of doing so in Unix-like systems.
For a process to start the execution of a different program, it first forks to create a copy of itself. Then, the copy, called the “child process”, calls the exec system call to overlay itself with the other program: it ceases execution of its former program in favor of the other systems.The child process has an exact copy of all the memory segments of the parent process, though if copy-on-write semantics are implemented, the physical memory need not be actually copied. Instead, virtual memory pages in both processes may refer to the same pages of physical memory until one of them writes to such a page: then it is copied. This optimization is important in the common case where fork is used in conjunction with exec to execute a new program: typically, the child process performs only a small set of actions before it ceases execution of its program in favour of the program to be started, and it requires very few, if any, of its parent’s data structures.

When a process calls fork, it is deemed the parent process, and the newly created process, its child. After the fork, both processes not only run the same program, but they resume execution as though both had called the system call. They can then inspect the call’s return value to determine their status, child or parent, and act accordingly.
Communication
The child process inherits the standard streams from its parent, along with the rest of the environment. For interprocess communication, the parent process will often create a pipe or several pipes, and then after forking the processes will close the ends of the pipes that they don’t need.

Posted in Uncategorized | Leave a comment

Character Driver(Writing data in the 1 quantum)

#here i write in the 1 quantum of the scull and by this i am able to write in the kernel layer....
RCS file: application.c,v
Working file: application.c
head: 1.7
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 7;	selected revisions: 7
description:
make the open call.
----------------------------
revision 1.7
date: 2014/05/18 09:45:03;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.6
date: 2014/05/18 09:10:37;  author: root;  state: Exp;  lines: +8 -8
*** empty log message ***
----------------------------
revision 1.5
date: 2014/05/18 04:26:31;  author: root;  state: Exp;  lines: +8 -7
*** empty log message ***
----------------------------
revision 1.4
date: 2014/05/13 15:18:27;  author: root;  state: Exp;  lines: +1 -0
include the string.h
----------------------------
revision 1.3
date: 2014/05/13 15:17:20;  author: root;  state: Exp;  lines: +5 -1
use the write system call.
----------------------------
revision 1.2
date: 2014/05/08 06:06:12;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.1
date: 2014/05/08 06:05:16;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: declaration.h,v
Working file: declaration.h
head: 1.4
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 4;	selected revisions: 4
description:
declare the extern variable as dev, nod, minorno and majorno.
----------------------------
revision 1.4
date: 2014/05/07 03:36:11;  author: root;  state: Exp;  lines: +5 -0
define extern for new_dev quantum_size qset_size data_size and device_size
----------------------------
revision 1.3
date: 2014/05/06 06:25:08;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.2
date: 2014/05/06 03:29:21;  author: root;  state: Exp;  lines: +6 -0
declare a structure SkullDev with a structure cdev define in cdev,h
----------------------------
revision 1.1
date: 2014/05/06 02:07:46;  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:
----------------------------
revision 1.1
date: 2014/05/08 04:56:14;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: header.h,v
Working file: header.h
head: 1.16
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 16;	selected revisions: 16
description:
including the linux/modules.
includding the linux/init.
define GPL.
----------------------------
revision 1.16
date: 2014/05/18 04:25:51;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.15
date: 2014/05/15 10:20:14;  author: root;  state: Exp;  lines: +1 -0
include asm-generic uaccess.h header file for the copy_to_user.
----------------------------
revision 1.14
date: 2014/05/13 13:27:30;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.13
date: 2014/05/11 14:39:30;  author: root;  state: Exp;  lines: +4 -0
make the macro for the header because its included multiple times in the program.....and we have to use __header as macro otherwise it leads to a error.
----------------------------
revision 1.12
date: 2014/05/07 03:41:07;  author: root;  state: Exp;  lines: +4 -4
define MACROS
----------------------------
revision 1.11
date: 2014/05/07 03:31:31;  author: root;  state: Exp;  lines: +27 -1
define macro for QSET_SIZE, QUANTUM_SIZE, DATA_SIZE and DEVICE_SIZE.
define structure ScullQset.
----------------------------
revision 1.10
date: 2014/05/06 07:17:41;  author: root;  state: Exp;  lines: +2 -1
include the moduleparam.h for the module_param i.e. passing the arguments in the kernel layer.
----------------------------
revision 1.9
date: 2014/05/06 06:36:59;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.8
date: 2014/05/06 06:33:38;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.7
date: 2014/05/06 06:31:04;  author: root;  state: Exp;  lines: +2 -0
include slab.h for the kmalloc and kdev_t for the Macros MINOR and MAJOR.
----------------------------
revision 1.6
date: 2014/05/06 06:26:43;  author: root;  state: Exp;  lines: +1 -0
include cdev.h header file for struct cdev
----------------------------
revision 1.5
date: 2014/05/06 06:24:27;  author: root;  state: Exp;  lines: +4 -0
declare the struct SkullDev in header instead of in declaration.h.
----------------------------
revision 1.4
date: 2014/05/06 02:12:04;  author: root;  state: Exp;  lines: +4 -4
redfine the macro in header file again.
----------------------------
revision 1.3
date: 2014/05/06 02:03:21;  author: root;  state: Exp;  lines: +17 -0
include the linux/fs.h
difine the macros DEVNAME N
----------------------------
revision 1.2
date: 2014/05/06 01:04:44;  author: root;  state: Exp;  lines: +1 -1
correct the license GPL
----------------------------
revision 1.1
date: 2014/05/06 00:58:23;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: cleanup.c,v
Working file: cleanup.c
head: 1.6
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;	selected revisions: 6
description:
use the module_exit(exitfn) and define the declaration of exitfn
----------------------------
revision 1.6
date: 2014/05/06 03:28:56;  author: root;  state: Exp;  lines: +1 -0
kfree the memory allocated during kmalloc.
----------------------------
revision 1.5
date: 2014/05/06 02:35:09;  author: root;  state: Exp;  lines: +2 -1
include the declaration.h in this.
----------------------------
revision 1.4
date: 2014/05/06 02:32:49;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.3
date: 2014/05/06 02:30:41;  author: root;  state: Exp;  lines: +1 -1
the function name we use as __
----------------------------
revision 1.2
date: 2014/05/06 02:06:30;  author: root;  state: Exp;  lines: +3 -1
call unregister_chrdev_region for the unregistration.
----------------------------
revision 1.1
date: 2014/05/06 01:00:24;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devopen.c,v
Working file: devopen.c
head: 1.4
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 4;	selected revisions: 4
description:
write the defination of the devopen
----------------------------
revision 1.4
date: 2014/05/13 14:35:37;  author: root;  state: Exp;  lines: +22 -0
call the trim function.
write the defination of the trim function.
----------------------------
revision 1.3
date: 2014/05/11 15:53:59;  author: root;  state: Exp;  lines: +3 -2
include declaration.h
----------------------------
revision 1.2
date: 2014/05/11 15:26:48;  author: root;  state: Exp;  lines: +12 -0
introduce container of  which is used to point out the memory of external device.
----------------------------
revision 1.1
date: 2014/05/08 04:56:14;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: devwrite.c,v
Working file: devwrite.c
head: 1.12
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 12;	selected revisions: 12
description:
write the devwrite function.
map the devwrite function.
----------------------------
revision 1.12
date: 2014/05/18 09:42:30;  author: root;  state: Exp;  lines: +1 -1
return the size-ret to the write system call of the application layer i.e application.c program.
----------------------------
revision 1.11
date: 2014/05/18 09:16:13;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.10
date: 2014/05/18 05:28:36;  author: root;  state: Exp;  lines: +7 -7
make the scullqset_creat qset_create and quantum_creat
make the 1 quantum for the world emblogic.
and make the 1 scullqset for the world emblogic
----------------------------
revision 1.9
date: 2014/05/18 04:26:34;  author: root;  state: Exp;  lines: +31 -15
*** empty log message ***
----------------------------
revision 1.8
date: 2014/05/15 14:20:59;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.7
date: 2014/05/15 11:56:09;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
----------------------------
revision 1.6
date: 2014/05/15 11:53:16;  author: root;  state: Exp;  lines: +6 -0
*** empty log message ***
----------------------------
revision 1.5
date: 2014/05/15 11:37:23;  author: root;  state: Exp;  lines: +7 -5
*** empty log message ***
----------------------------
revision 1.4
date: 2014/05/15 10:21:47;  author: root;  state: Exp;  lines: +28 -20
write the defination for the create_scullqset, create_qset, and create_quantum.
----------------------------
revision 1.3
date: 2014/05/13 17:03:30;  author: root;  state: Exp;  lines: +73 -0
*** empty log message ***
----------------------------
revision 1.2
date: 2014/05/13 15:12:20;  author: root;  state: Exp;  lines: +4 -1
give the defination of devwrite()
----------------------------
revision 1.1
date: 2014/05/13 15:07:20;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: init.c,v
Working file: init.c
head: 1.31
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 31;	selected revisions: 31
description:
use the module_init(initfn) and define the declaration of initfn
----------------------------
revision 1.31
date: 2014/05/18 04:26:28;  author: root;  state: Exp;  lines: +9 -0
*** empty log message ***
----------------------------
revision 1.30
date: 2014/05/13 13:27:32;  author: root;  state: Exp;  lines: +1 -0
*** empty log message ***
----------------------------
revision 1.29
date: 2014/05/08 03:47:42;  author: root;  state: Exp;  lines: +4 -4
*** empty log message ***
----------------------------
revision 1.28
date: 2014/05/08 03:31:38;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.27
date: 2014/05/08 03:30:27;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.26
date: 2014/05/08 03:28:42;  author: root;  state: Exp;  lines: +4 -2
*** empty log message ***
----------------------------
revision 1.25
date: 2014/05/08 03:20:39;  author: root;  state: Exp;  lines: +2 -1
*** empty log message ***
----------------------------
revision 1.24
date: 2014/05/08 03:15:11;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.23
date: 2014/05/08 03:05:46;  author: root;  state: Exp;  lines: +3 -3
*** empty log message ***
----------------------------
revision 1.22
date: 2014/05/08 03:00:33;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.21
date: 2014/05/08 02:59:54;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.20
date: 2014/05/08 02:13:15;  author: root;  state: Exp;  lines: +4 -3
replace by [] and -> by .
----------------------------
revision 1.19
date: 2014/05/08 02:06:31;  author: root;  state: Exp;  lines: +11 -7
print the major and minor number for all nodes.
----------------------------
revision 1.18
date: 2014/05/07 03:41:18;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.17
date: 2014/05/07 03:34:19;  author: root;  state: Exp;  lines: +29 -8
call MKDEV
call cdev_add
----------------------------
revision 1.16
date: 2014/05/06 07:34:43;  author: root;  state: Exp;  lines: +2 -1
*** empty log message ***
----------------------------
revision 1.15
date: 2014/05/06 07:32:45;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.14
date: 2014/05/06 07:23:46;  author: root;  state: Exp;  lines: +2 -2
define the module_param above the init_func
----------------------------
revision 1.13
date: 2014/05/06 07:18:42;  author: root;  state: Exp;  lines: +2 -0
define module_param call
----------------------------
revision 1.12
date: 2014/05/06 06:44:23;  author: root;  state: Exp;  lines: +2 -1
initilize the struct ScullDev above the function name
----------------------------
revision 1.11
date: 2014/05/06 06:24:59;  author: root;  state: Exp;  lines: +5 -5
*** empty log message ***
----------------------------
revision 1.10
date: 2014/05/06 03:34:40;  author: root;  state: Exp;  lines: +5 -5
*** empty log message ***
----------------------------
revision 1.9
date: 2014/05/06 03:31:46;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.8
date: 2014/05/06 03:26:36;  author: root;  state: Exp;  lines: +9 -0
call kmalloc and allocate the space uptp the structure SkullDev.
SkullDev is used to map the memory of the Device Driver.
defint the *skulldev which is extern and define in the struct SkullDev
----------------------------
revision 1.7
date: 2014/05/06 02:55:59;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.6
date: 2014/05/06 02:31:58;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.5
date: 2014/05/06 02:30:20;  author: root;  state: Exp;  lines: +2 -2
the fuction name we use __
----------------------------
revision 1.4
date: 2014/05/06 02:24:27;  author: root;  state: Exp;  lines: +2 -2
*** empty log message ***
----------------------------
revision 1.3
date: 2014/05/06 02:17:40;  author: root;  state: Exp;  lines: +5 -2
initialize the extern variable to MACRO within the function itself
----------------------------
revision 1.2
date: 2014/05/06 02:05:12;  author: root;  state: Exp;  lines: +21 -1
call alloc chr_dev region to register the DD into kernel and then call MAJOR and MINOR to display ita majorno and mno.
----------------------------
revision 1.1
date: 2014/05/06 00:59:15;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: prototype.h,v
Working file: prototype.h
head: 1.6
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 6;	selected revisions: 6
description:
mention the prototype of devopen and devrelease
----------------------------
revision 1.6
date: 2014/05/15 11:37:21;  author: root;  state: Exp;  lines: +1 -1
*** empty log message ***
----------------------------
revision 1.5
date: 2014/05/15 10:20:55;  author: root;  state: Exp;  lines: +3 -5
write the prototype fot the create_scullqset, create_qset, create_quantun.
----------------------------
revision 1.4
date: 2014/05/13 17:03:23;  author: root;  state: Exp;  lines: +4 -0
*** empty log message ***
----------------------------
revision 1.3
date: 2014/05/13 15:11:44;  author: root;  state: Exp;  lines: +1 -0
write the prototype of the devwrite()
----------------------------
revision 1.2
date: 2014/05/13 14:34:33;  author: root;  state: Exp;  lines: +1 -0
give the prototype of trim function used in the devopen and this trim function is used to flush the data, when its open in WR mode.
----------------------------
revision 1.1
date: 2014/05/08 04:56:14;  author: root;  state: Exp;
Initial revision
=============================================================================

RCS file: fileopr.h,v
Working file: fileopr.h
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1;	selected revisions: 1
description:
this is the mapping of the open close and write system call from the application layer to the kernel system call...
----------------------------
revision 1.1
date: 2014/05/18 09:50:00;  author: root;  state: Exp;
Initial revision
=============================================================================
Posted in Uncategorized | Leave a comment

signal

description:
a program of signal
—————————-
revision 1.1
date: 2014/05/18 06:45:26; author: root; state: Exp;
Initial revision
=============================================================================

Posted in Uncategorized | Leave a comment

semaphore

description:
semaphore program for a
=============================================================================

RCS file: sema4c,v
Working file: sema4c
head: 1.1
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 1; selected revisions: 0
description:
semaphore using semget ,semctl,semop
=============================================================================

Posted in Uncategorized | Leave a comment

Installing Arduino IDE in Fedora OS

 Open the terminal

First you log in as a super user

$ su

$ password: *******

After you log in as a super user, download these packages given below.

yum install arduino

yum install java-1.7.0-openjdk

After running these two commands , you will find arduino executable file in your file system . Run the executable file.

Posted in Uncategorized | Leave a comment

program for semaphore

head    1.1;
access;
symbols;
locks
root:1.1; strict;
comment    @ * @;

1.1
date    2014.05.17.07.43.53;    author root;    state Exp;
branches;
next    ;

desc
@the program of semafore .
@

1.1
log
@Initial revision
@
text
@#include<stdio.h>
#include<linux/sem.h>
#include<stdlib.h>
int main()
{
struct sembuf sem1;
sem1.sem_num=0;
sem1.sem_op=-1;
sem1.sem_flg=SEM_UNDO;
union semun u;
u.val=1;
int i,ret,kk;
kk=semget((key_t)123,1,IPC_CREAT|0777);
if(kk<0)
{
perror(“\nsemget failure”);
goto OUT;
}
ret=semctl(kk,0,SETVAL,u);
if(ret<0)
{
perror(“\n semctl is failure”);
goto OUT;
}
ret=semop(kk,&sem1,1);
for(i=1;i<4;i++)
{
printf(“\n i am raushan:::=%d”,getpid());
printf(“\n hi how are you:::=%d”,getpid());
printf(“\n who are you:::=%d”,getpid());
}
sem1.sem_num=0;
sem1.sem_op=1;
sem1.sem_flg=SEM_UNDO;
ret=semop(kk,&sem1,1);
return 0;
OUT:
return-1;
}
@

Posted in Uncategorized | Leave a comment