Presentation is loading. Please wait.

Presentation is loading. Please wait.

12.5 Synchronization BY PRIYANKA, HARSHA, JEJI & XIAOLONG ADVISOR- DR.YANQING ZHANG.

Similar presentations


Presentation on theme: "12.5 Synchronization BY PRIYANKA, HARSHA, JEJI & XIAOLONG ADVISOR- DR.YANQING ZHANG."— Presentation transcript:

1 12.5 Synchronization BY PRIYANKA, HARSHA, JEJI & XIAOLONG ADVISOR- DR.YANQING ZHANG

2 Outline Introduction WebDAV and implementation RCU Lock Future Work References

3 Introduction Synchronization is used to maintain uniformity and consistency of data across all the applications and storing devices It ensures same copy/version of data is used in all devices, allowing the data to be accessed or modified from multiple locations

4 Synchronization  Synchronization has not been an issue in most traditional Web-based Systems for two reasons: 1. Strict Client-Server Organization: Servers never exchanged information with other servers which means there is nothing much to synchronize 2. Web considered as read-mostly system: Updates are done by a Single person or entity => no write conflicts

5 Contd.. Things are changing because of increasing demand to provide support for collaborative authoring of Web documents Web should support concurrent updates of documents by a group of collaborating users or processes Increase in Web services increases need for servers to synchronize with each other

6 WebDAV Distributed authoring of Web documents is handled by a separate protocol known as WebDAV WebDAV stands for Web Distributed Authoring and Versioning It provides simple means to lock a shared document and to create, delete, copy and move documents from remote Web servers.

7 WebDAV Contd..  WebDAV provides two simple locking mechanisms(Write locks) 1. Exclusive write lock: It is assigned to a single client and will prevent any other client from modifying the shared document while it is locked. 2. Shared write lock: It allows multiple clients to simultaneously update the document. Shared write locks are convenient when clients modify different parts of the same document. Clients need to take care to prevent write-write conflict.

8 Assigning a lock Initially a lock token is passed on to the requesting client The server registers which client currently has the lock token. Whenever the client wants to modify the document, it sends an HTTP post request to the server, along with the lock token. The token shows that the client has write-access to the document, for which reason the server will carry out the request.

9 WebDAV WebDAV stands for Web Distributed Authoring and Versioning. Web Distributed Authoring and Versioning (WebDAV) is an extension of the Hypertext transfer control protocol(HTTP) that allows clients to perform remote Web content authoring operations. WebDav is a protocol that handles distributed authoring of Web documents.

10 Contd.. The WebDAV protocol provides a framework for users to create, change and move documents from remote web servers. The most important features of the WebDAV protocol include the maintenance of properties about an author or modification date, namespace management, collections, and overwrite protection

11 Contd.. Maintenance of properties includes such things as the creation, removal, and querying of file information. Namespace management deals with the ability to copy and move web pages within a server’s namespace. Collections deal with the creation, removal, and listing of various resources. Lastly, overwrite protection handles aspects related to locking of files.

12 How to Assign a Lock ? Initially a lock token is passed on to the requesting client The server registers which client currently has the lock token. Whenever the client wants to modify the document, it sends an HTTP post request to the server, along with the lock token. The token shows that the client has write-access to the document, for which reason the server will carry out the request.

13 Contd.. Important design scenario: There is no need to maintain a connection between the client and the server while holding the lock Client can simply disconnect from the server after acquiring the lock and reconnect to the server when sending an HTTP request The server will one way or the other have to reclaim the token in case if a client holding the token is crashed

14 Problem Suppose if a client holding a lock token crashes then the server will one way or the other have to reclaim the lock. WebDAV does not specify how servers should handle these and similar situations, but leaves that open to specific implementations. The best solution will depend on the type of documents that WebDAV is being used for. The reason for this approach is that there is no general way to solve the problem of orphan process locks in a clean way.

15 Orphan process Orphan process is where there are process that is running on the segments and there is no corresponding process related to the same gang on the master or other segments. This orphan process can arise when there is query abort, process crash, server / segment crash etc.

16 WebDAV-Sync The WebDAV-Sync tool is at the same time a command-line tool and an Ant task. It has three parameters: a URL which refers to a WebDAV collection, a local directory and the synchronization direction. The tool keeps the URL in sync with the directory depending on the direction, which can be down, up or bi-directional. The down direction is useful for cases where a lot of random file access will follow. The up direction is rather for updating offline work on the server. It takes only a few seconds to check if a local directory of around a thousand files is in sync with the WebDAV collection. This is important to reduce the overhead in build scripts when only a few files or directories have changed.

17 Implementation of WebDAV Protocol Common web browsers ◦Provide only limited support for accessing the HTTP methods ◦No support for accessing the header fields directly HTML forms are extended to provide direct access to these protocols Identification of the user interaction type to provide the protocol request Extensions are proposed to the HTML forms to improve the interaction between user and web browser

18 Implementation of WebDAV Protocol The browser is implemented in Wafe environment Wafe support several libraries like OSF/Motif, XOTcl, SSLeay, LDAP etc. For HTML rendering and parsing, Kino widget is used

19 Implementation of WebDAV Protocol Cineast ◦Extensible web browser ◦Implemented using OSF/Motif ◦Provides environment for prototyping new client side (server side) Internet technologies ◦Has built-in support for HTML forms

20 Implementation of WebDAV Protocol XOTcl ◦Object Oriented Scripting Language ◦Extension of Otcl which contains the language support for dynamic aggregations, per-object mixins and design patterns ◦Implements application logic and general networking functionality

21 Implementation of WebDAV Protocol Requirements for a web-based user interface for WebDAV ◦Requires user input ◦Three types of user requests are need to initiate a protocol request ◦Request URI ◦Identifies the location of the resource addressed by the protocol method ◦Request Header ◦Defines new header files that are necessary to store some parameters ◦Request Body ◦Body is an well formed XML element

22 Implementation of WebDav Protocol Application: WebDav-based Project Repository A simple web-based collaborative application is used The documents can be shared collaboratively in a controlled way Cineast web browser is used Apache web server with combination of mod_dav module is used To establish secure connection via SSL, cryptographic support from SSLeay toolkit is taken

23 Implementation of WebDAV Protocol Functionality and Structure Offers uploading and sharing of documents of various groups Consists set of folders Three levels of operations can be performed New functionality of WebDAV is to assign metadata to web documents Users of project repository able to define and query the metadata Using WebDAV methods, which are accessible via HTML forms

24 Implementation of WebDAV Protocol Implementation The project repository is viewed and accessed by web browser The functionality is accessed from web browser (Cineast) ◦For example, clicking the push buttons Implemented using WebDAV methods WebDAV methods can be accessed within web browser via HTML forms ◦For example, by clicking the push buttons on repository page a HTML form for corresponding WebDAV method with appropriate default value is displayed

25 Implementation of WebDAV Protocol Implementation Server side scripting can be used to automate the creation of these HTML forms Signing the signature or verifying the digital signature cannot be mapped to WebDAV methods Combining some particular WebDAV methods can over come the above hurdle ◦For example, to sign first retrieve (GET) the document and then upload (PUT) back to repository

26 How to synchronize the execution of multiple threads of same process ? Spin Locks Semaphors

27 Spin Locks vs. Semaphores Spin Locks: Busy waits waste CPU cycles. Can use in interrupt context, as does not sleep. Cannot use when code sleeps while holding lock. Use for locks held a short time. Semaphores: Context switch on sleep is expensive. Sleeps, so cannot use in interrupt context. Can use when code sleeps while holding lock. Use for locks that held a long time.

28 Reads-write lock When a writer is writing the data, all other writers or readers will be blocked until the writer is finished writing. usually constructed on top of mutexes and condition variables, or on top of semaphores. Need access memory atomically, which is related to memory access speed

29 Read-Copy Update (RCU)  Lock-free synchronization technique -improve rwlock  Allows multiple readers and writers at once.  RCU can only be used when All data structures are dynamically allocated and referenced by pointers. No kernel control path can sleep in critical region protected by RCU.

30 How does RCU work? 1.Reader set a flag in the RCU lock to inform others that it is using the lock. 2.Writer first inspect whether there exists read flag in the RCU lock. If it does, make a copy of original data, and write this copied data 3.Writer wait for all readers leaving, and then update the original data with the copied data.

31 How does RCU implement? Reader: rcu_read_lock(); /* disables kernel preemption */ /* Critical region (read only) */ rcu_read_unlock(); Writer: Makes a copy of data structure. Modifies the copy. Switches pointer to point to copy. Deallocates old struct when all readers are done ( when there exist task switching).

32 What is RCU?  Reader-writer synchronization mechanism Leverages read-mostly nature of many operating-system data structures  Writers use atomic commit points create new versions  Writers incur substantial overhead Writers must synchronize with each other Writers must defer destructive actions until readers are done

33 RCU Performance Challenges  How can readers signal writers? Atomic instruction? Can reader completion be inferred from existing system state?  How can destruction be deferred without burdening readers? Can costs of destruction be associated with writers and batched to amortize overhead?  How can memory consumption be limited?

34 How Does RCU Address Overheads?  Lock Contention Readers need not acquire locks: no contention!!! Writers can still suffer lock contention - But only with each other, and writers are infrequent - Very little contention!!!  Memory Latency Readers do not perform memory writes No need to communicate data among CPUs for cache consistency - Memory latency greatly reduced

35 RCU Research Challenges  Provide efficient RCU implementations Inferring reader signals from existing operations such as context switch Generalize this across multiple OS kernels  Evaluate RCU's performance CPU overhead Scalability Latency

36 Future work Since the burden of synchronization falls completely on the waiting readers to finish, how to allow concurrently conduct updating for writers is an interesting issue. There is no general way to solve the problem of the orphan process in the WebDAV. In order to prevent the issues caused by the orphan process we can carry out the operations using different protocols like AtomPub, a HTTP based protocol for creating and updating web services.

37 Reference  P. E. McKenney. Exploiting Deferred Destruction: An Analysis of Read-Copy-Update Techniques in Operating System Kernels. PhD thesis, OGI School of Science and Engineering at Oregon Health and Sciences University, 2004. Available: http://www.rdrop.com/users/paulmck/RCU/RCUdissertation.2004.07.14e1.pdf.http://www.rdrop.com/users/paulmck/RCU/RCUdissertation.2004.07.14e1.pdf  https://en.wikipedia.org/wiki/WebDAV https://en.wikipedia.org/wiki/WebDAV  Dridi, F.; Neumann, G., "How to implement Web-based groupware systems based on WebDAV," in Enabling Technologies: Infrastructure for Collaborative Enterprises, 1999. (WET ICE '99) Proceedings. IEEE 8th International Workshops on, vol., no., pp.114-119, 1999  http://wiki.fib.upc.es/sodx/images/5/51/8._Distributed_web-based_systems.pdf http://wiki.fib.upc.es/sodx/images/5/51/8._Distributed_web-based_systems.pdf  http://www.cs.cornell.edu/courses/cs4410/2013su/slides/lecture06.pdf http://www.cs.cornell.edu/courses/cs4410/2013su/slides/lecture06.pdf  https://msdn.microsoft.com/en-us/library/ms228964(v=vs.110).aspx https://msdn.microsoft.com/en-us/library/ms228964(v=vs.110).aspx  https://cseweb.ucsd.edu/classes/fa05/cse120/lectures/120-l5.pdf https://cseweb.ucsd.edu/classes/fa05/cse120/lectures/120-l5.pdf  Distributed Systems: Principles and Paradigms, Andrew S. Tanenbaum and Maarten Van Steen, 2006. (Second Edition)

38 Thank you !


Download ppt "12.5 Synchronization BY PRIYANKA, HARSHA, JEJI & XIAOLONG ADVISOR- DR.YANQING ZHANG."

Similar presentations


Ads by Google