Networking chapter V

668 views

Published on

Inter

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
668
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
28
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Networking chapter V

  1. 1. Compiled by: Jayakumar Balasubramanian Web: http://www.jwritings.com Email: [email_address]
  2. 2. A bit of history <ul><li>Unix – AT & T </li></ul><ul><li>University Of California Berkeley (UCB) </li></ul><ul><li>Berkeley System Distribution (BSD) </li></ul><ul><li>Linux networking stack </li></ul><ul><li>Bill Joy : Sun Microsystems </li></ul><ul><li>Variants of Unix: HPUX, AIX </li></ul><ul><li>Need for a common programming interface for better portability </li></ul><ul><li>IEEE : Portable Operating Systems Interface for Unix (POSIX) </li></ul>
  3. 3. Types of IPCs <ul><li>BSD mechanisms </li></ul><ul><ul><ul><li>Sockets </li></ul></ul></ul><ul><ul><ul><li>Pipes </li></ul></ul></ul><ul><ul><ul><li>FIFO </li></ul></ul></ul><ul><li>System-V mechanisms </li></ul><ul><ul><ul><li>Message Queues </li></ul></ul></ul><ul><ul><ul><li>Semaphores </li></ul></ul></ul><ul><ul><ul><li>Shared memory </li></ul></ul></ul>
  4. 4. Need for IPC mechanisms <ul><li>Embedded systems have got multiple processes to perform various specified tasks. </li></ul><ul><li>Each process want to communicate with other process to exchange data. </li></ul><ul><li>IPC mechanisms are very critical in Embedded system. </li></ul><ul><li>IPC mechanisms are designed according to POSIX standards. </li></ul>
  5. 5. Some example use cases <ul><li>Interrupt Service Routines (ISR) </li></ul><ul><li>High-priority Vs low priority processes </li></ul><ul><li>Common data structure access </li></ul><ul><li>Simple communication </li></ul><ul><li>Synchronization </li></ul>
  6. 6. Pipes <ul><li>The simplest IPC </li></ul><ul><li>Creating a pipe using ‘pipe()’ system call </li></ul><ul><li>Read file descriptor at index ‘0’ </li></ul><ul><li>Write file descriptor at index ‘1’ </li></ul><ul><li>Exchange of data using read() and write() system calls. </li></ul><ul><li>When used along with fork() it becomes very powerful . </li></ul>
  7. 7. Pipes use case
  8. 8. Message queues
  9. 9. Message queue APIs <ul><li>key_t ftok (const char *path, int id); </li></ul><ul><li>int msgget (key_t key, int msgflg); </li></ul><ul><li>int msgsnd (int msqid, const void *msgp, size_t msgsz, int msgflg); </li></ul><ul><li>int msgrcv (int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); </li></ul><ul><li>int msgctl (int msqid, int cmd, struct msqid_ds *buf); </li></ul>
  10. 10. Message queue buffer <ul><li>struct msgbuf { </li></ul><ul><li>long mtype; /* Mandatory type field */ </li></ul><ul><li>char mtext[1]; /* The user data */ </li></ul><ul><li>}; </li></ul>
  11. 11. Web : http://www.jwritings.com Email: [email_address]

×