26.02.2014 Views

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

Getting Started with QNX Neutrino - QNX Software Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The client’s view<br />

© 2009, <strong>QNX</strong> <strong>Software</strong> <strong>Systems</strong> GmbH & Co. KG.<br />

Client summary<br />

2 Response from the process manager: “Talk to fs-cache first, and then<br />

fs-nfs.”<br />

3 Message to fs-cache: “I’d like to open the file /nfs/home/rk/abc.txt for<br />

write, please.”<br />

4 Response from fs-cache: “Sure, no problem.”<br />

Notice that this time, in step 3, we opened the file for write and not read as we did<br />

previously. It’s not surprising, therefore, that fs-cache allowed the operation this<br />

time (in step 4).<br />

Even more interesting, observe what happens the next time we go to read the file:<br />

1 Message to the process manager: “Who should I talk to about the filename<br />

/nfs/home/rk/abc.txt?”<br />

2 Response from the process manager: “Talk to fs-cache first, and then<br />

fs-nfs.”<br />

3 Message to fs-cache: “I’d like to open the file /nfs/home/rk/abc.txt for<br />

read, please.”<br />

4 Response from fs-cache: “Sure, no problem.”<br />

Sure enough, the caching filesystem handled the request for the read this time (in step<br />

4)!<br />

Now, we’ve left out a few details, but these aren’t important to getting across the basic<br />

ideas. Obviously, the caching filesystem will need some way of sending the data<br />

across the network to the “real” storage medium. It should also have some way of<br />

verifying that no one else modified the file just before it returns the file contents to the<br />

client (so that the client doesn’t get stale data). The caching filesystem could handle<br />

the first read request itself, by loading the data from the network filesystem on the first<br />

read into its cache. And so on.<br />

We’re done <strong>with</strong> the client side of things. The following are key points to remember:<br />

• The client usually triggers communication <strong>with</strong> the resource manager via open()<br />

(or fopen()).<br />

• Once the client’s request has “resolved” to a particular resource manager, we never<br />

change resource managers.<br />

• All further messages for the client’s session are based on the file descriptor (or<br />

FILE * stream), (e.g., read(), lseek(), fgets()).<br />

• The session is terminated (or “dissociated”) when the client closes the file<br />

descriptor or stream (or terminates for any reason).<br />

• All client file-descriptor-based function calls are translated into messages.<br />

198 Chapter 5 • Resource Managers April 30, 2009

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!