Follow me on Linkedin

InterProcess Communication

InterProcess Communication

Interprocess communication (IPC) is the transfer of data among processes.
   five types of interprocess communication:
       1)Shared memory permits processes to communicate by simply reading and
          writing to a specified memory location.
       2)Mapped memory is similar to shared memory, except that it is associated with a
          file in the filesystem.
       3)Pipes permit sequential communication from one process to a related process.
       4)FIFOs are similar to pipes, except that unrelated processes can communicate
          because the pipe is given a name in the filesystem.
       5)Sockets support communication between unrelated processes even on different
          computers.

Shared Memory:

One of the simplest interprocess communication methods is using shared memory.
Shared memory allows two or more processes to access the same memory as if they all called malloc and were returned pointers to the same actual memory.When one
process changes the memory, all the other processes see the modification.
Shared memory is the fastest form of interprocess communication because all
processes share the same piece of memory. Access to this shared memory is as fast as accessing a process’s nonshared memory.

The Memory Model:

To use a shared memory segment, one process must allocate the segment.Then each
process desiring to access the segment must attach the segment. After finishing its use
of the segment, each process detaches the segment. At some point, one process must
deallocate the segment.
Allocating a new shared memory segment causes virtual memory pages to be created.
Because all processes desire to access the same shared segment, only one process
should allocate a new shared segment. Allocating an existing segment does not create
new pages, but it does return an identifier for the existing pages.To permit a process
to use the shared memory segment, a process attaches it, which adds entries mapping
from its virtual memory to the segment’s shared pages.When finished with the segment,
these mapping entries are removed.When no more processes want to access
these shared memory segments, exactly one process must deallocate the virtual
memory pages.All shared memory segments are allocated as integral multiples of the system’s page
size, which is the number of bytes in a page of memory.

Allocation:

A process allocates a shared memory segment using shmget (“SHared Memory
GET”).

Name
shmget - allocates a shared memory segment
Synopsis
#include <sys/ipc.h>
#include <sys/shm.h>

int shmget(key_t key, size_t size, int shmflg);
Explanation:
Its first parameter is an integer key that specifies which segment to create.
Unrelated processes can access the same shared segment by specifying the same key
value.conflict. Using the special constant IPC_PRIVATE as the key value guarantees
that a brand new memory segment is created.
Its second parameter specifies the number of bytes in the segment. Because segments
are allocated using pages, the number of actually allocated bytes is rounded up
to an integral multiple of the page size.
The third parameter is the bitwise or of flag values that specify options to shmget.
The FLAG VALUES include these:
<-->IPC_CREAT—This flag indicates that a new segment should be created.This permits
      creating a new segment while specifying a key value.
<-->IPC_EXCL—This flag, which is always used with IPC_CREAT, causes shmget to fail
       if a segment key is specified that already exists. 
<-->Mode flags—This value is made of 9 bits indicating permissions granted to
      owner, group, and world to control access to the segment.
      An easy way to specify permissions is to use the constants defined in <sys/stat.h>
For Example:
    S_IRUSR and S_IWUSR specify read and write permissions for the owner of the
shared memory segment, and S_IROTH and S_IWOTH specify read and write permissions
for others.
Attachment and Detachment:

int shmat ( int shmid, char *shmaddr, int shmflg);

To make the shared memory segment available, a process must use shmat,“SHared
Memory ATtach.”
Pass it the shared memory segment identifier SHMID returned byshmget.
The second argument is a pointer that specifies where in your process’s address
space you want to map the shared memory; If shmaddr is NULL, the system chooses a 
suitable (unused) address at which to attach the segment.
The third argument is a flag, which can include the following:
<--> SHM_RND indicates that the address specified for the second parameter should be
rounded down to a multiple of the page size. If you don’t specify this flag, you
must page-align the second argument to shmat yourself.
<--> SHM_RDONLY indicates that the segment will be only read, not written.
Debugging:
The ipcs command provides information on interprocess communication facilities,
including shared segments. Use the -m flag to obtain information about shared
memory. For example, this code illustrates that one shared memory segment,
numbered 1627649, is in use:
% ipcs -m
------ Shared Memory Segments --------
key                   shmid        owner           perms          bytes         nattch status
0x00000000     1627649     user             640              25600       0

Some Applications Of PhotoShop

Painting effect:

--->Open an image > Press ctrl+ J to create a duplicate layer
--->Go to filter > Other >High Pass >1.5 radius >ok
--->Go to filter >Artistic >film grain filter > 0,19,10
--->Highlight Area is the most important value. In most cases you'll notice that a value between18-20 will give you the best results.

--->Change the blending mode to overlay
--->Go to filter >artistic > cutout > 8,0,3 ( try values between 6-8.)
--->Press ctrl +J to create another copy of background copy
--->Filter/Artistic/Poster Edges > 10,10,0
--->Set the blending mode of this layer to Multiply and the Opacity to about 30%

Sea Horse:

--->Create a new 450X350 pixels document. 
--->Set a dark blue color (#146fe0) for a foreground and light blue color (#0fe0ff) color for a                 background. Apply Filter > Render > Clouds.
--->Create a new layer. Apply Edit > Fill > White color. 
--->Set white color for a foreground and light blue color (#acc6f0) color for a background on this           layer.
--->Apply Filter > Render > Fibers with the following settings: 
    Variance -> 26, Strength -> 13 and set the Blending Mode as 'Color Dodge'. Merge down these        layers. 
--->Duplicate this layer. Go to a new layer 'Background copy'. Now we have to make horizontal           fibers from vertical. 
--->Apply Edit > Transform > Rotate 90CW and then apply Edit > Transform > Scale and stretch        this layer out full length.
--->Apply Image > Adjustment > Hue/Saturation with the following settings: Hue -> 194, Saturation      100, Lightness -> +12. 
--->Then apply Filter > Brush Strokes > Spatter with the following settings: Spray Radius -> 13,           Smoothness -> 14.
--->Go to the 'Background' layer. Set a light green color (#daf4f8) for a foreground and light blue        color (#b1daf2) for a background. 
--->Apply Filter > Render > Clouds. Go to the 'Background copy' layer. Choose the Eraser Tool           and erase the upper part of the picture. 
--->Then go to the 'Background' layer and apply Filter > Render > Lens Flare with the following           settings: Brightness -> 100%, Lens Type -> 50-30mm Zoom twice. Merge down these layers.

Lava Planet Creation:

--->Create new doc 800*800 pixels, 72 resolutions
--->Create a new layer select a elliptical marquee tool. Draw a circle.
      And press d for default colors.
--->Go to filter menu > select render > difference clouds.
--->Press ctrl+f (2 ) times to increase the effect
--->Press ctrl+L  to adjust the levels.
--->Filter > sharpen >un sharp mask >500,3,30
--->Filter > distort > spherize. And apply 100% and again apply 50%
--->Press ctrl+B select shadow and apply +100, 0,-100
     M(100,0,100) , H(100,0,-15)
--->Press ctrl+U >hue=15, saturation=20
--->Filter > sharpen unsharp mask amount 300,3,15
--->Create a new layer and apply black color.
--->Select the planet layer right click> blending Options > Outer glow >gold effect.

Pencil Drawing:

--->Open ur image.
--->Deasturate it, Image >Adjustments> Desaturate.
--->Duplicate layer > and invert colors
--->Now in layer pallate select color dodge.
--->Now go to filter >Blur >gaussian blur >9radius.
--->Now see final result.
--->Picture engraved in stone:
--->Open an rock image and other photo.
--->Now drag the photo in front of rock image.
--->Go to filter >sketch >photo copy >2,27
--->Now just change the layer color mode to color dodge.

Tips for Students Who is Preparing for Placement

Here are some tips to the students who is preparing for Placement.



The first thing is Dress Code.

    One should remember that the first impression is the best impression. Hence it is advisable to come well dressed. The dress code for boys is normally a dark coloured pant with light coloured full hands shirt with tucked in. They are expected to wear shoes and for ladies it is a light coloured dress. However, I have observed that the students who come in tucked in for the first time are more nervous because of the uneasiness they have when as they wear it for the first time. Hence it is advisable to make a habit to always come well dressed to college. In addition to this, the students are advised to have a professional outlook and approach. Punctuality, parking their vehicles in proper place, talking slowly and gently near the interview hall will all add up to their getting selected.

Some other tips :
  * Reach the interview venue on time.
  * Be well dressed.
  * Be professional in approach.
  * Prepare answers for frequently asked questions.
  * Know more about the company by browsing the net before appearing for the interview.
  * Practice problems related to the topics of the aptitude test.
  * Be thorough in at least in one subject of your choice so that you can encourage the interviewer to ask more questions in that subject.
  * Improve your communication skills.
  * Practice group discussions with your classmates and peers.
  * Prepare well and be confident. Remember that the others are your classmate and they are no greater than you.
  * Be positive in attitude while answering the questions.

                                                              ALL THE BEST !!


For more interview questions and interview experience , Follow us on http://www.newwayofengineering.in

Anil K Jain - Fundamentals of Digital Image Processing Download


Author : Anil K Jain

Book : Fundamentals of Digital Image Processing

Publisher : Prentice Hall

Description:

Presents a thorough overview of the major topics of digital image processing, beginning with the basic mathematical tools needed for the subject. Includes a comprehensive chapter on stochastic models for digital image processing.Covers aspects of image representation including luminance, color, spatial and temporal properties of vision, and digitization. Explores various image processing techniques. Discusses algorithm development (software/firmware) for image transforms, enhancement, reconstruction, and image coding.

Download Link : Click Here (Google Drive)

Download Link : Click Here ( Mediafire )

Tags : Fundamentals of Digital Image Processing pdf , Fundamentals of Digital Image Processing ebook , Fundamentals of Digital Image Processing Anil K Jain , Fundamentals of Digital Image Processing Anil K Jain , Fundamentals of Digital Image Processing Anil K Jain download , Fundamentals of Digital Image Processing Anil K Jain pdf , Fundamentals of Digital Image Processing Anil K Jain ebook download , Fundamentals of Digital Image Processing Anil K Jain book pdf , Fundamentals of Digital Image Processing Anil K Jain ebook pdf , Fundamentals of Digital Image Processing Anil K Jain 3rd edition , Fundamentals of Digital Image Processing Anil K Jain third edition , Fundamentals of Digital Image Processing Anil K Jain new edition , Fundamentals of Digital Image Processing Anil K Jain fourth edition , Fundamentals of Digital Image Processing Anil K Jain 4th edition , Fundamentals of Digital Image Processing Anil K Jain third edition pdf , Fundamentals of Digital Image Processing Anil K Jain fourth edition ebook download , Digital Image Processing books , Digital Image Processing ebooks , Digital Image Processing pdf download , Digital Image Processing Books

                      Feel Free to contact us newwayofengineering@gmail.com

Theory Of Computing - ebook Download


Author: Peter Linz

Book : An Introduction to Formal Languages and Automata
Publisher: Jones & Bartlett Publishers; 3rd edition
Format: pdf
Language: English
Description :

An Introduction to Formal Language and Automata By Peter Linz 3 rd Edition


Download Link : Click Here ( Mediafire )

Download Link : Click Here (Google Drive)

  ( Click Ctrl + S in Google drive to download )


Tags : An Introduction to Formal Language and Automata By Peter Linz 3rd edition , ebook download , An Introduction to Formal Language and Automata , Peter Linz ebook Download , theory of computing ebook download , theory of computing , theory of computing pdf, peter linz pdf , Jones & Bartlett Publishers; 3rd edition , An Introduction to Formal Language and Automata pdf , An Introduction to Formal Language and Automata ebook , An Introduction to Formal Language and Automata download , An Introduction to Formal Language and Automata 3rd edition , An Introduction to Formal Language and Automata third edition , An Introduction to Formal Language and Automata 4th edition , An Introduction to Formal Language and Automata fourth edition , An Introduction to Formal Language and Automata 5th edition , An Introduction to Formal Language and Automata fifth edition , An Introduction to Formal Language and Automata new edition  , peter linz , PETER LINZ , peter linz 3rd edition , peter linz third edition , peter linz 4th edition , peter linz fourth edition , peter linz 5th edition , peter linz fifth edition

Amazon Interview Experience - Ankur Arora

                                                       By :  Ankur Arora

So this is for all of you, who are going to attend Amazon’s Placement drive at SASTRA on 13th-14th August, 2013. I have been approached by a lot of juniors who want to know about the process Amazon follows, so I suppose this is the best place for everyone to see this.
Firstly get one thing set in your mind; they are only interested in your coding skills, your thought processing and your ability to come up with efficient solutions to the problems.

About last year’s interview process:

Round 1: It was a written round. 28 objective questions from Apti, OS, Linux, Networks, Linux and Programming were asked. Of course the major part was on programming but a couple of questions each was asked from other streams. 2 Coding questions were also asked. They were powered by ‘InterviewStreet’ and we had to code and compile online to verify the result.

Round 2: This was a group round. Not a GD though. All the candidates were divided into 4 groups of around 8 each and every group was assigned a mentor out of the Amazon people who had come for the placement process. A coding question on Trees was displayed on the projector and everyone was asked to come up with a solution. First we had to get the solution verified by the respective mentor and only then we were to write the code for that. It is an important round because they see how you handle such long questions which need a lot of thinking and how do you come up with a good solution and convince the mentor that your solution will work properly. They gave one hour for this round.

Round 3: This was a personal technical interview. One interviewer will ask you coding questions which you need to solve on paper. And the most important part is how you improve the efficiency of your code after you have written it for the first time. The number of questions asked in this round depends upon how you have answered the previous questions and also on the interviewer’s mood.

Round 4: This again is a personal technical interview. But this time they will ask not only coding questions but also theoretical questions to check your knowledge on subjects like OS, OOAD and Networks. This will by far be the deciding round because here they check your overall knowledge.

Round 5: This will be a personal non-technical interview. The interviewer will mostly be the hiring manager himself and he’ll just ask about your interests and hobbies and how has your interview experience been so far. Try demonstrating your interest in the job and also try and tell him about your technical expertise and any other point you want to bring to his notice. Very few come up to this round. So if you are there, then half the battle has been won.

Areas you should concentrate upon:

For the written round prepare analytical C/C++ questions well. You should be comfortable with pointers and data structure implementations. Also brush up on your Linux, OS and Networking concepts. No one wants you to deep dive and become champion of these fields but you should always be able to understand the question and think about the correct answer.

For the group round and technical interviews, brush up on your Data Structures, especially Trees, Heaps and Dynamic Arrays. It will be a plus point if you know some concepts like vectors and arraylist and you are able to apply them while coding the solution.

For the non-tech interview and also other rounds, be confident when you are talking to the interviewer and always discuss with him about the way you are solving a certain problem. Your approach to the problem is as important as the fact that you are able to get the final result or not, so tell him each step you are doing and keep him involved. Long pauses in between are usually not good.

So having given you this information, remember that the process might be different for you people. But these guidelines will never the less help you. Give your best in all the rounds because the final decision is based on the cumulative of scores you get in each round.

All the best. Hope to see some of you in Amazon soon 
Ankur  Arora


Labels :
Amazon interview experience , amazon selection process , ankur arora amazon , sastra university amazon , sastra university ankur arora , sastra university placement , Amazon placement ,  placement preparation , how to place in amazon.

Implementing data link layer framing method bit stuffing in java Program

         Implementing data link layer framing method bit stuffing in java Program

import java.io.*;
public class aslamjai
{
public static void main(String args[]) throws IOException
{
int temp;
int data[]=new int[8];
int flag[]=new int[5];

int fdata[]=new int[25];
int fidata[]=new int[25];

DataInputStream obj= new DataInputStream(System.in);
System.out.println("Enter the Data Bits.....");

for (int i=0;i<8;i++)
{
data[i] = Integer.parseInt(obj.readLine());
}
System.out.println("Enter Flag Bits.....");

for (int i=0;i<5;i++)
{
flag[i] = Integer.parseInt(obj.readLine());
}
int idx=0;
for (int i=0;i<5;i++)
{
fdata[idx++] = flag[i];
}
for (int i=0;i<8;i++)
{
fdata[idx++] = data[i];
}

for (int i=0;i<5;i++)
{
fdata[idx++] = flag[i];
}
int fidx=0,count=0;
for(int i=0;i<idx;i++)
{
fidata[fidx++]=fdata[i];

if(fdata[i]==1)
count++;
else
count=0;
if(count==5)
{
fidata[fidx++]=0;
count=0;
}
}
System.out.print("Stuff Data : ");
for(int i=0;i<fidx;i++)
{
System.out.print(fidata[i]);
}

int k;
int mycount=0;
int mysecondcount=0;
int  mydata[]=new int[25];
for(k=0;k<fidx;k++)
{
mydata[mysecondcount++]=fidata[k];

if(fidata[k]==1)
mycount++;
else
mycount=0;

if(mycount==5)
{
mycount=0;
k++;
}
}
int j=mysecondcount;
System.out.println(" ");
System.out.print("Inverse : ");
for(int g=0;g<j;g++)
{
System.out.print(mydata[g]);
}
}
}



a