Noaman Ahmad, Ben Baenen, Chen Chen, Jakob Eriksson
{"title":"信任委托:可扩展、类型和内存安全的锁替代方案","authors":"Noaman Ahmad, Ben Baenen, Chen Chen, Jakob Eriksson","doi":"arxiv-2408.11173","DOIUrl":null,"url":null,"abstract":"We present Trust<T>, a general, type- and memory-safe alternative to locking\nin concurrent programs. Instead of synchronizing multi-threaded access to an\nobject of type T with a lock, the programmer may place the object in a\nTrust<T>. The object is then no longer directly accessible. Instead a\ndesignated thread, the object's trustee, is responsible for applying any\nrequested operations to the object, as requested via the Trust<T> API. Locking\nis often said to offer a limited throughput per lock. Trust<T> is based on\ndelegation, a message-passing technique which does not suffer this per-lock\nlimitation. Instead, per-object throughput is limited by the capacity of the\nobject's trustee, which is typically considerably higher. Our evaluation shows\nTrust<T> consistently and considerably outperforming locking where lock\ncontention exists, with up to 22x higher throughput in microbenchmarks, and\n5-9x for a home grown key-value store, as well as memcached, in situations with\nhigh lock contention. Moreover, Trust<T> is competitive with locks even in the\nabsence of lock contention.","PeriodicalId":501291,"journal":{"name":"arXiv - CS - Performance","volume":"5 1","pages":""},"PeriodicalIF":0.0000,"publicationDate":"2024-08-20","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":"{\"title\":\"Delegation with Trust: A Scalable, Type- and Memory-Safe Alternative to Locks\",\"authors\":\"Noaman Ahmad, Ben Baenen, Chen Chen, Jakob Eriksson\",\"doi\":\"arxiv-2408.11173\",\"DOIUrl\":null,\"url\":null,\"abstract\":\"We present Trust<T>, a general, type- and memory-safe alternative to locking\\nin concurrent programs. Instead of synchronizing multi-threaded access to an\\nobject of type T with a lock, the programmer may place the object in a\\nTrust<T>. The object is then no longer directly accessible. Instead a\\ndesignated thread, the object's trustee, is responsible for applying any\\nrequested operations to the object, as requested via the Trust<T> API. Locking\\nis often said to offer a limited throughput per lock. Trust<T> is based on\\ndelegation, a message-passing technique which does not suffer this per-lock\\nlimitation. Instead, per-object throughput is limited by the capacity of the\\nobject's trustee, which is typically considerably higher. Our evaluation shows\\nTrust<T> consistently and considerably outperforming locking where lock\\ncontention exists, with up to 22x higher throughput in microbenchmarks, and\\n5-9x for a home grown key-value store, as well as memcached, in situations with\\nhigh lock contention. Moreover, Trust<T> is competitive with locks even in the\\nabsence of lock contention.\",\"PeriodicalId\":501291,\"journal\":{\"name\":\"arXiv - CS - Performance\",\"volume\":\"5 1\",\"pages\":\"\"},\"PeriodicalIF\":0.0000,\"publicationDate\":\"2024-08-20\",\"publicationTypes\":\"Journal Article\",\"fieldsOfStudy\":null,\"isOpenAccess\":false,\"openAccessPdf\":\"\",\"citationCount\":\"0\",\"resultStr\":null,\"platform\":\"Semanticscholar\",\"paperid\":null,\"PeriodicalName\":\"arXiv - CS - Performance\",\"FirstCategoryId\":\"1085\",\"ListUrlMain\":\"https://doi.org/arxiv-2408.11173\",\"RegionNum\":0,\"RegionCategory\":null,\"ArticlePicture\":[],\"TitleCN\":null,\"AbstractTextCN\":null,\"PMCID\":null,\"EPubDate\":\"\",\"PubModel\":\"\",\"JCR\":\"\",\"JCRName\":\"\",\"Score\":null,\"Total\":0}","platform":"Semanticscholar","paperid":null,"PeriodicalName":"arXiv - CS - Performance","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/arxiv-2408.11173","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
摘要
我们提出了 "信任"(Trust)这一通用的、类型和内存安全的并发程序锁定替代方案。程序员可以将 T 类型的对象置于信任中,而不是用锁来同步多线程对该对象的访问。这样,对象就不再被直接访问。取而代之的是,指定的线程,即对象的受托人,负责对对象执行任何通过信任 API 请求的操作。锁定通常被认为每锁提供的吞吐量有限。而信任是基于委托的,这是一种消息传递技术,不会受到每个锁的限制。相反,每个对象的吞吐量受限于对象托管人的容量,而托管人的容量通常要高得多。我们的评估结果表明,在存在锁竞争的情况下,信任技术的性能始终大大优于锁定技术,在微基准测试中,信任技术的吞吐量比锁定技术高出 22 倍;在锁竞争严重的情况下,信任技术的吞吐量比自家开发的键值存储和 memcached 高出 5-9 倍。此外,即使在没有锁竞争的情况下,Trust 也能与锁竞争。
Delegation with Trust: A Scalable, Type- and Memory-Safe Alternative to Locks
We present Trust, a general, type- and memory-safe alternative to locking
in concurrent programs. Instead of synchronizing multi-threaded access to an
object of type T with a lock, the programmer may place the object in a
Trust. The object is then no longer directly accessible. Instead a
designated thread, the object's trustee, is responsible for applying any
requested operations to the object, as requested via the Trust API. Locking
is often said to offer a limited throughput per lock. Trust is based on
delegation, a message-passing technique which does not suffer this per-lock
limitation. Instead, per-object throughput is limited by the capacity of the
object's trustee, which is typically considerably higher. Our evaluation shows
Trust consistently and considerably outperforming locking where lock
contention exists, with up to 22x higher throughput in microbenchmarks, and
5-9x for a home grown key-value store, as well as memcached, in situations with
high lock contention. Moreover, Trust is competitive with locks even in the
absence of lock contention.