Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value Sharing System #101

Open
Geson-anko opened this issue May 10, 2022 · 4 comments
Open

Value Sharing System #101

Geson-anko opened this issue May 10, 2022 · 4 comments

Comments

@Geson-anko
Copy link
Owner

Geson-anko commented May 10, 2022

アプリケーション間で値を共有する方法を実装します。
FolderDictを用いて値を管理します。separatorは.(core.name.SEP)を使用します。
nameがMAIN.AppというアプリがQueueという名前で値を共有するとき、次のような形で登録されます。

<FolderDict>["MAIN.App.Queue"] = value 
@Geson-anko
Copy link
Owner Author

Geson-anko commented May 10, 2022

Shared Memory Writable/ReadOnly

アプリケーション(プロセス/スレッド)間で値共有をする時につかう、意図しない値の変更を防ぐ機能を持たせたクラスを実装します。

Example

import multiprocessing as mp
v = mp.Value('I', 0)
writable = make_writable(v)
readonly = make_readonly(v)
> readonly.value
--> 0
> readonly.value = 1
RuntimeError: Read only shared memory

> writable.value = 2 # OK

shutdownなどの、特定のプロセス/スレッドからのみ値の変更を許したい時に使用します。

@Geson-anko
Copy link
Owner Author

Barrier with shutdown

@Geson-anko
Copy link
Owner Author

Shared Memory Numpy Array

numpy.ndarrayをshared memoryとして簡単に共有するためのインタフェースを提供します。

@Geson-anko
Copy link
Owner Author

FolderDict_withLock

FolderDictのサブクラスです。複数のスレッドから同時に読み込みや書き込みが行われないようFolderDictをLockで保護します。
The subclass of FolderDict. It protects FolderDict with Lock to prevent multiple threads from reading and writing at the same time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant