freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

計(jì)算機(jī)畢業(yè)設(shè)計(jì)外文翻譯--現(xiàn)代并發(fā)抽象c#(存儲(chǔ)版)

2025-06-30 17:12上一頁面

下一頁面
  

【正文】 locks on a single processor or multiprocessor, but with the ability to handle asynchronous events without unnecessarily blocking clients for long periods, and without deadlocking. In other words, the focus is shifting from shared memory concurrency to message or event oriented concurrency. These new requirements deserve programming constructs that can handle asynchronous munications well and that are not shackled to the shared memory approach. Despite the development of a large collection of design pat terns [Lea 1999] and of many concurrent languages [America 1989。 public async Put(string s) { return s。 } public string Get() amp。 virtual async h() { /? body2 ?/ } } } class D : C { override async g () { /? body3 ?/ } one would, by overriding g (), have also ?half ? overridden f (). More pragmatically, removing the restriction on inheritance makes it all too easy to introduce inadvertent deadlock (or ?async leakage?). If the above code were legal, then code writ。 this is an allowable implementation. ACM Transactions on Programming Languages and Systems, Vol. 26, No. 5, September 2020 (. all the methods in the chord are asynchronous) does the body run in a new thread, and in that case there is no value to be returned. It should also be pointed out that the Buffer code, trivial though it is, is threadsafe. The locking that is required (for example to prevent the argument to a single Put being returned to two distinct Gets) is generated automatically by the piler. More precisely, deciding whether any chord is enabled by a call and, if so, removing the other pending calls from the queues and scheduling the body for execution, is an atomic operation. Apart from this atomicity guarantee, however, there is no monitor like mutual exclusion between chord bodies. Any mutual exclusion that is required must be explicitly programmed in terms of synchronization conditions in chord headers. The Buffer example uses a single chord to de?ne two methods. It is also possible (and mon) to have multiple chords involving a given method. For example: public class Buffer { public string Get() amp。 they are declared by using the async keyword instead of void. Calling an asynchronous method is much like sending a message, or posting an event. Since asynchronous methods have to return immediately, the behaviour of a method such as async postEvent(EventInfo data) { // large method body } is the only thing it could reasonably be: the call returns immediately and ?large method body? is scheduled for execution in a different thread (either a new one spawned to service this call, or a worker from some pool). However, this kind of de?nition is actually rather rare in Polyphonic C . More monly, asynchronous methods are de?ned using chords, as described below, and do not necessarily require new threads. Chords. A chord (also called a ?synchronization pattern?, or ?join pattern?) consists of a header and a body. The header is a set of method declarations separated by ?amp。 Detlefs et al. 1998。 (args[1], x . secondcb)。 } public void wait(out int i, out int j ) amp。例如,回調(diào)使用一個(gè)字符串參數(shù),服務(wù)代表,并返回一個(gè)整數(shù),看起來類似于: public delegate async IntCallback(int result)。為此,我們?cè)黾宇~外的共享狀態(tài): T(),我們不接受新的讀者,idleExclusive(),在我們所提供的獨(dú)占鎖以前選擇主題: 10 class ReaderWriterFair { } . . . // same content as in ReaderWriterPrivate, plus: public void ReleaseShared() amp。 async s() { if (??n == 0) idle()。 } private int n = 0。 async s(int n) { if (n == 1) idle()。一個(gè)典型的解決這個(gè)問題,使用傳統(tǒng)的并發(fā)原語在 Modula3 給出由,比勒爾 [1989]。 含蓄。 return o。 一個(gè)簡單的細(xì)胞類 我們先從一個(gè)簡單的地方細(xì)胞類的實(shí)現(xiàn)。 public int g (int j ) { t . reply( j )。如果這只因?yàn)榫€程的身份可以得到平等檢查,這個(gè)問題將是相當(dāng)學(xué)術(shù)。類的組成控制一個(gè)復(fù)雜的的打字紀(jì)律,防止“消息不理解為“在運(yùn)行時(shí)的錯(cuò)誤。請(qǐng)注意,在繼承的限制手段,如聲明 virtual void f () amp。 [2020]連接的情況下討論了“繼承異?!蔽⒎e分)。 ( 4)在方法頭中出現(xiàn)的所有形參必須有鮮明的標(biāo)識(shí)。非正式規(guī)范 語 法 到 C 語法的語法擴(kuò)展 [ECMA 2020, Appendix C]是非常次要的。例如: public class Buffer { public string Get() amp。只是,如果沒有這樣的方法(即在弦的所有方法都是異步)運(yùn)行在一個(gè)新的線程,在這種情況下,有沒有要返 回的值。 buff . Put(“blue”)。 string Get()方法是一個(gè)同步的方法不接受參數(shù)并返回一個(gè)字符串。更常見的異步方法是使用如下所述的復(fù)調(diào),定義,不一定需要新的線程。 異步方法。此外, .NET 庫實(shí)現(xiàn)了許多傳統(tǒng)的并發(fā)控制原語,如信號(hào)量,互斥和讀 /寫鎖,以及異步編程模型的基礎(chǔ)上代表。這一切都是真的有可能只有一個(gè)擁有上譜“,可以發(fā)生的事情”:這個(gè)手柄可以處理由并發(fā)操作,既可以隱藏,從而使多個(gè)語法實(shí)現(xiàn)技術(shù)。在最低水平,設(shè)備驅(qū)動(dòng)程序必須對(duì)異步設(shè)備事件迅速作出反應(yīng),而資源利用上的吝嗇。 Reppy 1992。監(jiān)控器的一般概念已經(jīng)變得非常流行,特別是在其目前的面向?qū)ο蟮男问骄€程和對(duì)象綁定互斥,但它已提供作為一個(gè)語法的外殼模板,最可選鎖定對(duì)象上的方法調(diào)用。 在原則上,可以提供許多功能,無論是作為語言特性或作為庫:典型的例子是,內(nèi)存管理和異常。盡管這樣,最流行的編程語言對(duì)待并發(fā)語言不是作為一種語言功能的并發(fā)性,而往往是作為一個(gè)收集的,根據(jù)指定的外部庫。并發(fā)可以顯著影響一個(gè)結(jié)構(gòu)中的語言的含義(開始轉(zhuǎn)讓的原子),并能影響調(diào)用庫的能力。然而,即使當(dāng)并發(fā)庫被正 確指定,但由于他們是庫,而不是語言的特點(diǎn)這個(gè)事實(shí),還是會(huì)有不良的后果。在 70 年代開始在這個(gè)方向作了很多嘗試,顯示器 [霍爾 1974年 ]的概念和奧卡姆語言 [INMOS有限公司 1984](基于通信順序進(jìn)程 [霍爾 1985])。 Agha et 。 異步編程 異步的事件和消息傳遞越來越多地用于在各級(jí)軟件系統(tǒng)。編譯器可狀態(tài)機(jī)轉(zhuǎn)換成并發(fā)的一些模式,優(yōu)化使用隊(duì)列,使用輕量級(jí)的線程,在可能的情況下,避免分叉線程沒有必要的,并使用線程池。 C#語言,包括一個(gè) lock 語句,執(zhí)行的過程中獲得一個(gè)給定的對(duì)象相關(guān)聯(lián)的互斥阻塞。 基本思路 到 C#的相當(dāng)傳統(tǒng)的面向?qū)ο缶幊棠P?,?fù)調(diào) C#增加了兩個(gè)新概念:異步方法和復(fù)調(diào)。然而,這樣的定義,實(shí)際上是相當(dāng)難得的 C#復(fù)調(diào)。 } } 上面的代碼定義了兩個(gè)實(shí)例方法的類的緩沖區(qū),這是共同定義在一個(gè)單一的復(fù)調(diào)。 到底哪的電話匹配是不確定的,所以即使是單線程程序如: Buffer buff = new Buffer()。如果有這種方法,然后身體在與調(diào)用線程運(yùn)行這一號(hào)召的方法,并返回值。這也是(普通)有涉及給定方法的多復(fù)調(diào)。 3。 ( 3)如果弦有一個(gè)返回類型的類型的方法頭,然后身體可能使用返回類型的表達(dá)式的語句,否則身體可能使用空的 return 語句。 條件 9 提供了一個(gè)保守的,但簡單,完整 性檢查時(shí),煉油類包含復(fù)調(diào)以來,在一般情況下,實(shí)現(xiàn)繼承和并發(fā)不拌勻 [松岡和米澤 1993](見富爾等。如果上面的代碼是合法的,那么代碼編寫的期望,使匹配的 C 類的實(shí)例 F()和 g()的調(diào)用將無法工作時(shí),通過 D 所有的實(shí)例 g()的調(diào)用會(huì)導(dǎo)致 body3 運(yùn)行,所有的調(diào)用 f()的僵局。像往常一樣,然后創(chuàng)建對(duì)象可以實(shí)例化類,同步模式是不可擴(kuò)展的。然而,也必須決定在封鎖線程機(jī)構(gòu)應(yīng)運(yùn)行,這樣的選擇一般觀察。 } private async af (int i, Thunk t) amp。復(fù)調(diào) c的編程 在介紹語言,我們現(xiàn)在怎么可能被用來解決并發(fā)編程問題的范圍。 private async contains(object o) { empty()。如果我們獲得()單元格的內(nèi)容,然后包含一個(gè)空的對(duì)象,返回值是 o。沒有其他共享訪問塊的請(qǐng)求,直到客戶端具有獨(dú)占訪問,同時(shí)請(qǐng)求,直到?jīng)]有獨(dú)占訪問塊其他客戶端有任何訪問。 } public void ReleaseShared() amp。盡管如此,相反,我們可以編寫以下等效的代碼: class ReaderWriterPrivate { } ReaderWriter() { idle()。 } public void ReleaseShared() amp。我們進(jìn)一步完善這個(gè)代碼來實(shí)現(xiàn)一個(gè)特定的公平當(dāng)有掛起的編寫者,至少 讀者和編寫者之間:一位編寫者,將獲得目前所有的讀者釋放它的鎖。 async idleExclusive() {} 合并異步消息 消息傳遞通常會(huì)由服務(wù)器的外部接口,使用異步方法,每個(gè)參數(shù)都需要參數(shù)的請(qǐng)求和發(fā)送請(qǐng)求已經(jīng)服務(wù)的最終結(jié)果或通知的地方。 secondcb = new IntCallback(second)。 (args*0+, x . ?r
點(diǎn)擊復(fù)制文檔內(nèi)容
畢業(yè)設(shè)計(jì)相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1