SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Minor Technical Issues
Thread Initialization
Continuation Tracking
Time and std::chrono
Thread Initialization
Current thread architecture
 Event threads and dedicated threads
 Event threads dispatch events from queues and do socket I/O.
 Dedicated threads execute a single event.
 Threads are kept in a global table
 Each event thread has thread local storage which contains an Ethread
instance.
Thread Initialization
 Thread initialization is done in a very unsafe manner.
 Threads are started.
 “Later”, but not too much later, the main thread updates data structures in the
other threads.
 Issues
 Obviously unsafe, despite it seeming to work.
 Thread initialization is monolithic due to having to put all the logic in one
intervention call site to avoid more race conditions.
 Event loop update (TS-4260) removed an unused method that was used by another
patch (NUMA), need to add it back.
TS-4265
Update thread initialization
 Change thread arrays to be arrays of structures to consolidate thread
information.
 Do thread initialization via continuations.
 Together these enable different parts of the process start logic to execute
code in another thread, during thread startup, without races with each other
or the thread.
 Intended for event threads.
 Not really needed for dedicated threads.
Start events
 Implementation – re-use the “oneevent” member for event threads.
 Currently only used by dedicated threads.
 Change event threads to execute this event if set.
 Put a core event there that then executes a queue of other events.
 Thread initialization means putting an event in this “spawn queue”.
Scheduling at spawn
 EThread::schedule_spawn
 Single continuation per thread that is called first for regular thread.
 EventProcessor::schedule_spawn
 Multiple functions that are invoked when an event thread is started.
 Built on top of thread schedule spawn.
Other changes
 Event processor startup
 Net processor startup
 NUMA and processor affinity
Continuation Tracking
Track original source of continuations
 Originally designed for plugin priorities.
 Need to know which plugin for a continuation to get the priority correct.
 Allows access to plugin registration and related data.
 Requested as an independent feature.
 For debugging to track continuation problems back to specific plugins.
 Potentially useful for disabling plugins.
Implementation
 Borrow a technique from per client IP debugging.
 Add per thread data item which points at the plugin registration data.
 Track current “plugin context”
 During plugin load any continuations created are tagged with the plugin data.
 During event dispatch
 Current plugin context is saved.
 Context is loaded from continuation.
 After event the old context is restored.
 When a continuation is created it gets the current context.
Consequences
 Plugin registration data pointer becomes continuation context.
 Need “core” plugin to represent continuations from the core and not a plugin.
 Can go off track if plugins “trade” continuations.
 Dispatch can check plugin state before calling continuation handler.
Todo
 Switch to C++ eleventy thread storage.
IP Allow Extension
IP Allow
 Quinn’s project.
 Extend IP allow rules to control outbound connections based on the origin IP
address.
 Enable control of IP Allow rule enforcement in remap rules.
 Currently if full DENY then connection closed before remap.
IP Allow implementation
 Add “dest_ip” key to ip_allow.config.
 Add “ip_allow” as a remap filter so it can be turned off and on.
 On by default
 Disable able early / accept check if any remap rule has IP Allow disabled.
 Global effect –if any remap rule bypasses IP Allow then the fast check is not done.
Example – allow outbound only to the
10/8 net
dest_ip 10.0.0.0-10.255.255.255 action=ALLOW
dest_ip 0.0.0.0-255.255.255.255 action=DENY
Example - remap
# ip_allow.config
src_ip=127.0.0.1 action=ip_allow method=ALL
src_ip=::1 action=ip_allow method=ALL
src_ip=0.0.0.0-255.255.255.255 action=ip_deny method=PUSH|PURGE|DELETE
src_ip=::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff action=ip_deny
method=PUSH|PURGE|DELETE
# remap.config – disable ip_allow for the remaps, let everything else be denied
.deactivatefilter ip_allow
remap ….allow purge….
remap … allow purge….
.activatefilter ip_allow
std::chrono
Time keeping in C++ eleventy
std::chrono and time
 std::chrono is a library for handling time intervals.
 NOT calendar time! That’s a very different thing.
 Instances are efficient
 Only the time unit is stored.
 Other properties are class properties known by the compiler.
 Conversions are known at compile time and inlined.
 Conversions are semi-automatic.
 Conversions to finer resolution are automatic.
 Conversions to coarser resolution require explicit conversion.
 Information is never unintentionally lost.
std::chrono duration and time points
 A duration is a length of time.
 A timepoint is a specific point in time.
 Represented internally as a duration and an epoch.
 Epoch is a globally defined and known point in time.
 E.g. standard UNIX epoch 1 Jan 1970.
std::chrono conversions and arguments
 Expressing exactly what time unit is desired is easy.
 std::chrono::milliseconds(5)
 std::chrono::hours(1)
 Automatic conversions let these be passed to any parameter that is at least as
fined grained.
 If methods take std::chrono::nanoseconds then passing time is easy.
 Caller does not need to know the parameter granularity unless it is coarser in which case
it is good to get a compile time error.
void leif_nap(std::chrono::nanoseconds length);
// ...
{
leif_nap(std::chrono::minutes(30));
leif_nap(std::chrono::days(2));
}
ATS example
// from P_CacheInternal.h
int cache_config_mutex_retry_delay = 2;
trigger = mutex->thread_holding->schedule_in_local(this,
HRTIME_MSECONDS(cache_config_mutex_retry_delay), event);
// vs
ts::milliseconds cache_config_mutex_retry_delay{2};
trigger = mutex->thread_holding->schedule_in_local(this,
cache_config_mutex_retry_delay, event);
std::chrono and clocks
 std::chrono supports clocks
 system_clock
 monotonic_clock
 high_precision_clock
 My research indicates that in real life system_clock and high_precision_clock are
the same thing and sometimes monotonic_clock as well.
 Time points are based on a specific clock because that clock embodies the
epoch.
 Durations are clock independent.
Active Projects
 TS-974: Partial Object Caching
 TS-4260: Event loop improvements
 TS-4999: Plugin priority
 TS-4532: std::chrono
 TS-3347: make ink_assert a no-op in release mode.
 TS-4593: Extend IP allow to outbound connections.

Weitere ähnliche Inhalte

Was ist angesagt?

End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and awaitvfabro
 
Asynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyAsynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyErsin Er
 
Async and Await on the Server
Async and Await on the ServerAsync and Await on the Server
Async and Await on the ServerDoug Jones
 
CTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitCTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitSpiffy
 
Runtime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkRuntime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkESUG
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with RxjavaChristophe Marchal
 
Apache Flink Training: DataStream API Part 1 Basic
 Apache Flink Training: DataStream API Part 1 Basic Apache Flink Training: DataStream API Part 1 Basic
Apache Flink Training: DataStream API Part 1 BasicFlink Forward
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examplesPeter Lawrey
 
Runtime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkRuntime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkMarcus Denker
 
Monitoring Kafka w/ Prometheus
Monitoring Kafka w/ PrometheusMonitoring Kafka w/ Prometheus
Monitoring Kafka w/ Prometheuskawamuray
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaRick Warren
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transferVictor Cherkassky
 
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollectivePuppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollectivePuppet
 

Was ist angesagt? (20)

Reactive Java (33rd Degree)
Reactive Java (33rd Degree)Reactive Java (33rd Degree)
Reactive Java (33rd Degree)
 
End to-end async and await
End to-end async and awaitEnd to-end async and await
End to-end async and await
 
Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)Reactive Java (GeeCON 2014)
Reactive Java (GeeCON 2014)
 
Asynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with NettyAsynchronous, Event-driven Network Application Development with Netty
Asynchronous, Event-driven Network Application Development with Netty
 
Async and Await on the Server
Async and Await on the ServerAsync and Await on the Server
Async and Await on the Server
 
CTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & AwaitCTU June 2011 - C# 5.0 - ASYNC & Await
CTU June 2011 - C# 5.0 - ASYNC & Await
 
Runtime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkRuntime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for Smalltalk
 
Async Programming in C# 5
Async Programming in C# 5Async Programming in C# 5
Async Programming in C# 5
 
Reactive programming with Rxjava
Reactive programming with RxjavaReactive programming with Rxjava
Reactive programming with Rxjava
 
Introduction to Reactive Java
Introduction to Reactive JavaIntroduction to Reactive Java
Introduction to Reactive Java
 
Apache Flink Training: DataStream API Part 1 Basic
 Apache Flink Training: DataStream API Part 1 Basic Apache Flink Training: DataStream API Part 1 Basic
Apache Flink Training: DataStream API Part 1 Basic
 
Reactive programming with examples
Reactive programming with examplesReactive programming with examples
Reactive programming with examples
 
Runtime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for SmalltalkRuntime Bytecode Transformation for Smalltalk
Runtime Bytecode Transformation for Smalltalk
 
Monitoring Kafka w/ Prometheus
Monitoring Kafka w/ PrometheusMonitoring Kafka w/ Prometheus
Monitoring Kafka w/ Prometheus
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
Netty: asynchronous data transfer
Netty: asynchronous data transferNetty: asynchronous data transfer
Netty: asynchronous data transfer
 
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollectivePuppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
Puppet Camp DC 2015: Distributed OpenSCAP Compliance Validation with MCollective
 
RxJava Applied
RxJava AppliedRxJava Applied
RxJava Applied
 
Async/Await
Async/AwaitAsync/Await
Async/Await
 
Async await
Async awaitAsync await
Async await
 

Ähnlich wie AMC Minor Technical Issues

1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2Stanley Ho
 
MULTI-THREADING in python appalication.pptx
MULTI-THREADING in python appalication.pptxMULTI-THREADING in python appalication.pptx
MULTI-THREADING in python appalication.pptxSaiDhanushM
 
On the benchmark of Chainer
On the benchmark of ChainerOn the benchmark of Chainer
On the benchmark of ChainerKenta Oono
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsPeter Tröger
 
PCD - Process control daemon
PCD - Process control daemonPCD - Process control daemon
PCD - Process control daemonhaish
 
Operating system NachOS
Operating system NachOSOperating system NachOS
Operating system NachOSPrasannPatel4
 
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...CODE BLUE
 
Positive Hack Days. Pavlov. Network Infrastructure Security Assessment
Positive Hack Days. Pavlov. Network Infrastructure Security AssessmentPositive Hack Days. Pavlov. Network Infrastructure Security Assessment
Positive Hack Days. Pavlov. Network Infrastructure Security AssessmentPositive Hack Days
 
Document 14 (6).pdf
Document 14 (6).pdfDocument 14 (6).pdf
Document 14 (6).pdfRajMantry
 
Multithreading
MultithreadingMultithreading
Multithreadingbackdoor
 
Interview questions
Interview questionsInterview questions
Interview questionsxavier john
 
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking.NET Multithreading/Multitasking
.NET Multithreading/MultitaskingSasha Kravchuk
 
Computer arithmetic in computer architecture
Computer arithmetic in computer architectureComputer arithmetic in computer architecture
Computer arithmetic in computer architectureishapadhy
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and pythonChetan Giridhar
 
IEC 60870-5 101 Protocol Server Simulator User manual
IEC 60870-5 101 Protocol Server Simulator User manualIEC 60870-5 101 Protocol Server Simulator User manual
IEC 60870-5 101 Protocol Server Simulator User manualFreyrSCADA Embedded Solution
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threadsrchakra
 

Ähnlich wie AMC Minor Technical Issues (20)

1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
 
Threads
ThreadsThreads
Threads
 
MULTI-THREADING in python appalication.pptx
MULTI-THREADING in python appalication.pptxMULTI-THREADING in python appalication.pptx
MULTI-THREADING in python appalication.pptx
 
MultiThreading in Python
MultiThreading in PythonMultiThreading in Python
MultiThreading in Python
 
On the benchmark of Chainer
On the benchmark of ChainerOn the benchmark of Chainer
On the benchmark of Chainer
 
Operating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - ThreadsOperating Systems 1 (7/12) - Threads
Operating Systems 1 (7/12) - Threads
 
PCD - Process control daemon
PCD - Process control daemonPCD - Process control daemon
PCD - Process control daemon
 
Operating system NachOS
Operating system NachOSOperating system NachOS
Operating system NachOS
 
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
[CB16] COFI break – Breaking exploits with Processor trace and Practical cont...
 
Positive Hack Days. Pavlov. Network Infrastructure Security Assessment
Positive Hack Days. Pavlov. Network Infrastructure Security AssessmentPositive Hack Days. Pavlov. Network Infrastructure Security Assessment
Positive Hack Days. Pavlov. Network Infrastructure Security Assessment
 
Document 14 (6).pdf
Document 14 (6).pdfDocument 14 (6).pdf
Document 14 (6).pdf
 
Operating System lab
Operating System labOperating System lab
Operating System lab
 
Multithreading
MultithreadingMultithreading
Multithreading
 
Training – Going Async
Training – Going AsyncTraining – Going Async
Training – Going Async
 
Interview questions
Interview questionsInterview questions
Interview questions
 
.NET Multithreading/Multitasking
.NET Multithreading/Multitasking.NET Multithreading/Multitasking
.NET Multithreading/Multitasking
 
Computer arithmetic in computer architecture
Computer arithmetic in computer architectureComputer arithmetic in computer architecture
Computer arithmetic in computer architecture
 
Async programming and python
Async programming and pythonAsync programming and python
Async programming and python
 
IEC 60870-5 101 Protocol Server Simulator User manual
IEC 60870-5 101 Protocol Server Simulator User manualIEC 60870-5 101 Protocol Server Simulator User manual
IEC 60870-5 101 Protocol Server Simulator User manual
 
Intro To .Net Threads
Intro To .Net ThreadsIntro To .Net Threads
Intro To .Net Threads
 

Kürzlich hochgeladen

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 

Kürzlich hochgeladen (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 

AMC Minor Technical Issues

  • 1. Minor Technical Issues Thread Initialization Continuation Tracking Time and std::chrono
  • 3. Current thread architecture  Event threads and dedicated threads  Event threads dispatch events from queues and do socket I/O.  Dedicated threads execute a single event.  Threads are kept in a global table  Each event thread has thread local storage which contains an Ethread instance.
  • 4. Thread Initialization  Thread initialization is done in a very unsafe manner.  Threads are started.  “Later”, but not too much later, the main thread updates data structures in the other threads.  Issues  Obviously unsafe, despite it seeming to work.  Thread initialization is monolithic due to having to put all the logic in one intervention call site to avoid more race conditions.  Event loop update (TS-4260) removed an unused method that was used by another patch (NUMA), need to add it back.
  • 5. TS-4265 Update thread initialization  Change thread arrays to be arrays of structures to consolidate thread information.  Do thread initialization via continuations.  Together these enable different parts of the process start logic to execute code in another thread, during thread startup, without races with each other or the thread.  Intended for event threads.  Not really needed for dedicated threads.
  • 6. Start events  Implementation – re-use the “oneevent” member for event threads.  Currently only used by dedicated threads.  Change event threads to execute this event if set.  Put a core event there that then executes a queue of other events.  Thread initialization means putting an event in this “spawn queue”.
  • 7. Scheduling at spawn  EThread::schedule_spawn  Single continuation per thread that is called first for regular thread.  EventProcessor::schedule_spawn  Multiple functions that are invoked when an event thread is started.  Built on top of thread schedule spawn.
  • 8. Other changes  Event processor startup  Net processor startup  NUMA and processor affinity
  • 10. Track original source of continuations  Originally designed for plugin priorities.  Need to know which plugin for a continuation to get the priority correct.  Allows access to plugin registration and related data.  Requested as an independent feature.  For debugging to track continuation problems back to specific plugins.  Potentially useful for disabling plugins.
  • 11. Implementation  Borrow a technique from per client IP debugging.  Add per thread data item which points at the plugin registration data.  Track current “plugin context”  During plugin load any continuations created are tagged with the plugin data.  During event dispatch  Current plugin context is saved.  Context is loaded from continuation.  After event the old context is restored.  When a continuation is created it gets the current context.
  • 12. Consequences  Plugin registration data pointer becomes continuation context.  Need “core” plugin to represent continuations from the core and not a plugin.  Can go off track if plugins “trade” continuations.  Dispatch can check plugin state before calling continuation handler.
  • 13. Todo  Switch to C++ eleventy thread storage.
  • 15. IP Allow  Quinn’s project.  Extend IP allow rules to control outbound connections based on the origin IP address.  Enable control of IP Allow rule enforcement in remap rules.  Currently if full DENY then connection closed before remap.
  • 16. IP Allow implementation  Add “dest_ip” key to ip_allow.config.  Add “ip_allow” as a remap filter so it can be turned off and on.  On by default  Disable able early / accept check if any remap rule has IP Allow disabled.  Global effect –if any remap rule bypasses IP Allow then the fast check is not done.
  • 17. Example – allow outbound only to the 10/8 net dest_ip 10.0.0.0-10.255.255.255 action=ALLOW dest_ip 0.0.0.0-255.255.255.255 action=DENY
  • 18. Example - remap # ip_allow.config src_ip=127.0.0.1 action=ip_allow method=ALL src_ip=::1 action=ip_allow method=ALL src_ip=0.0.0.0-255.255.255.255 action=ip_deny method=PUSH|PURGE|DELETE src_ip=::-ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff action=ip_deny method=PUSH|PURGE|DELETE # remap.config – disable ip_allow for the remaps, let everything else be denied .deactivatefilter ip_allow remap ….allow purge…. remap … allow purge…. .activatefilter ip_allow
  • 20. std::chrono and time  std::chrono is a library for handling time intervals.  NOT calendar time! That’s a very different thing.  Instances are efficient  Only the time unit is stored.  Other properties are class properties known by the compiler.  Conversions are known at compile time and inlined.  Conversions are semi-automatic.  Conversions to finer resolution are automatic.  Conversions to coarser resolution require explicit conversion.  Information is never unintentionally lost.
  • 21. std::chrono duration and time points  A duration is a length of time.  A timepoint is a specific point in time.  Represented internally as a duration and an epoch.  Epoch is a globally defined and known point in time.  E.g. standard UNIX epoch 1 Jan 1970.
  • 22. std::chrono conversions and arguments  Expressing exactly what time unit is desired is easy.  std::chrono::milliseconds(5)  std::chrono::hours(1)  Automatic conversions let these be passed to any parameter that is at least as fined grained.  If methods take std::chrono::nanoseconds then passing time is easy.  Caller does not need to know the parameter granularity unless it is coarser in which case it is good to get a compile time error. void leif_nap(std::chrono::nanoseconds length); // ... { leif_nap(std::chrono::minutes(30)); leif_nap(std::chrono::days(2)); }
  • 23. ATS example // from P_CacheInternal.h int cache_config_mutex_retry_delay = 2; trigger = mutex->thread_holding->schedule_in_local(this, HRTIME_MSECONDS(cache_config_mutex_retry_delay), event); // vs ts::milliseconds cache_config_mutex_retry_delay{2}; trigger = mutex->thread_holding->schedule_in_local(this, cache_config_mutex_retry_delay, event);
  • 24. std::chrono and clocks  std::chrono supports clocks  system_clock  monotonic_clock  high_precision_clock  My research indicates that in real life system_clock and high_precision_clock are the same thing and sometimes monotonic_clock as well.  Time points are based on a specific clock because that clock embodies the epoch.  Durations are clock independent.
  • 25. Active Projects  TS-974: Partial Object Caching  TS-4260: Event loop improvements  TS-4999: Plugin priority  TS-4532: std::chrono  TS-3347: make ink_assert a no-op in release mode.  TS-4593: Extend IP allow to outbound connections.

Hinweis der Redaktion

  1. Can talk about std::ratio if that seems useful.
  2. Note that the compiler will provide the conversion multiplication automatically.
  3. Note my problems with CLOCK_MONOTONIC.