DOC PREVIEW
UCSD CSE 120 - Network File System / RPC

This preview shows page 1-2-21-22 out of 22 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 22 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Lecture 15:Lecture 15:Network File System / RPCNetwork File System / RPCCSE 120: Principles of Operating SystemsAlex C. SnoerenLab 2 Due TONIGHTCSE 120 – Lecture 15: Network File System / RPC 2Network File SystemNetwork File System Simple idea: access disks attached to other computers◆ Share the disk with many other machines as well NFS is a protocol for remote access to a file system◆ Does not implement a file system per se◆ Remote access is transparent to applications File system, OS, and architecture independent◆ Originally developed by Sun◆ Although Unix-y in flavor, explicit goal to work beyond Unix Client/server architecture◆ Local file system requests are forwarded to a remote server◆ Requests are implemented as remote procedure calls (RPCs)CSE 120 – Lecture 15: Network File System / RPC 3Remote Procedure CallRemote Procedure Call RPC is common means for remote communication It is used both by operating systems and applications◆ NFS is implemented as a set of RPCs◆ DCOM, CORBA, Java RMI, etc., are all basically just RPC Someday (soon?) you will most likely have to write anapplication that uses remote communication (or youalready have)◆ You will most likely use some form of RPC for that remotecommunication◆ So it’s good to know how all this RPC stuff works Let’s focus on RPC before getting back to NFS◆ Once we have RPC, NFS isn’t too hard to build…CSE 120 – Lecture 15: Network File System / RPC 4Clients and ServersClients and Servers The prevalent model for structuring distributedcomputation is the client/server paradigm A server is a program (or collection of programs) thatprovide a service (file server, name service, etc.)◆ The server may exist on one or more nodes◆ Often the node is called the server, too, which is confusing A client is a program that uses the service◆ A client first binds to the server (locates it and establishes aconnection to it)◆ A client then sends requests, with data, to perform actions,and the servers sends responses, also with dataCSE 120 – Lecture 15: Network File System / RPC 5MessagesMessages Initially with network programming, people hand-codedmessages to send requests and responses Hand-coding messages gets tiresome◆ Need to worry about message formats◆ Have to pack and unpack data from messages◆ Servers have to decode and dispatch messages to handlers◆ Messages are often asynchronous Messages are not a very natural programming model◆ Could encapsulate messaging into a library◆ Just invoke library routines to send a message◆ Which leads us to RPC…CSE 120 – Lecture 15: Network File System / RPC 6Procedure CallsProcedure Calls Procedure calls are a more natural way to communicate◆ Every language supports them◆ Semantics are well-defined and understood◆ Natural for programmers to use Idea: Have servers export a set of procedures that canbe called by client programs◆ Similar to module interfaces, class definitions, etc. Clients just do a procedure call as it they were directlylinked with the server◆ Under the covers, the procedure call is converted into amessage exchange with the serverCSE 120 – Lecture 15: Network File System / RPC 7RemoteRemote Procedure Calls Procedure Calls So, we would like to use procedure call as a model fordistributed (remote) communication Lots of issues◆ How do we make this invisible to the programmer?◆ What are the semantics of parameter passing?◆ How do we bind (locate, connect to) servers?◆ How do we support heterogeneity (OS, arch, language)?◆ How do we make it perform well?CSE 120 – Lecture 15: Network File System / RPC 8RPC ModelRPC Model A server defines the server’s interface using aninterface definition language (IDL)◆ The IDL specifies the names, parameters, and types for allclient-callable server procedures A stub compiler reads the IDL and produces two stubprocedures for each server procedure (client andserver)◆ The server programmer implements the server proceduresand links them with the server-side stubs◆ The client programmer implements the client program andlinks it with the client-side stubs◆ The stubs are responsible for managing all details of theremote communication between client and serverCSE 120 – Lecture 15: Network File System / RPC 9RPC StubsRPC Stubs A client-side stub is a procedure that looks to the clientas if it were a callable server procedure A server-side stub looks to the server as if a clientcalled it The client program thinks it is calling the server◆ In fact, it’s calling the client stub The server program thinks it is called by the client◆ In fact, it’s called by the server stub The stubs send messages to each other to make theRPC happen “transparently”CSE 120 – Lecture 15: Network File System / RPC 10RPC ExampleRPC ExampleServer Interface:int Add(int x, int y);Client Program:…sum = server->Add(3,4);…Server Program:int Add(int x, int, y) { return x + y;} If the server were just a library, then Add would just bea procedure callCSE 120 – Lecture 15: Network File System / RPC 11RPC Example: CallRPC Example: CallClient Program:sum = server->Add(3,4);Server Program:int Add(int x, int, y) {}Client Stub:Int Add(int x, int y) { Alloc message buffer; Mark as “Add” call; Store x, y into buffer; Send message;}RPC Runtime:Send message to server;Server Stub:Add_Stub(Message) { Remove x, y from buffer r = Add(x, y);}RPC Runtime:Receive message;Dispatch, call Add_Stub;CSE 120 – Lecture 15: Network File System / RPC 12RPC Example: ReturnRPC Example: ReturnClient Program:sum = server->Add(3,4);Server Program:int Add(int x, int, y) {}Client Stub:Int Add(int x, int y) { Create, send message; Remove r from reply; return r;}RPC Runtime:Return reply to stub;Server Stub:Add_Stub(Message) { Remove x, y from buffer r = Add(x, y); Store r in buffer;}RPC Runtime:Send reply to client;CSE 120 – Lecture 15: Network File System / RPC 13RPC MarshallingRPC Marshalling Marshalling is the packing of procedure parametersinto a message packet The RPC stubs call type-specific procedures tomarshal (or unmarshal) the parameters to a call◆ The client stub marshals the parameters into a message◆ The server stub unmarshals parameters from the messageand uses them to call the server procedure On return◆ The server stub marshals the return parameters◆ The client stub unmarshals return


View Full Document

UCSD CSE 120 - Network File System / RPC

Documents in this Course
Threads

Threads

14 pages

Deadlocks

Deadlocks

19 pages

Processes

Processes

14 pages

Paging

Paging

13 pages

Processes

Processes

18 pages

Threads

Threads

29 pages

Security

Security

16 pages

Paging

Paging

13 pages

Processes

Processes

32 pages

Lecture 2

Lecture 2

13 pages

Paging

Paging

8 pages

Threads

Threads

14 pages

Paging

Paging

13 pages

Paging

Paging

26 pages

Paging

Paging

13 pages

Lecture

Lecture

13 pages

Processes

Processes

14 pages

Paging

Paging

13 pages

Security

Security

17 pages

Threads

Threads

15 pages

Processes

Processes

34 pages

Structure

Structure

10 pages

Lecture 3

Lecture 3

13 pages

Lecture 1

Lecture 1

28 pages

Threads

Threads

15 pages

Paging

Paging

30 pages

Load more
Download Network File System / RPC
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Network File System / RPC and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Network File System / RPC 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?