دسترسی نامحدود
برای کاربرانی که ثبت نام کرده اند
برای ارتباط با ما می توانید از طریق شماره موبایل زیر از طریق تماس و پیامک با ما در ارتباط باشید
در صورت عدم پاسخ گویی از طریق پیامک با پشتیبان در ارتباط باشید
برای کاربرانی که ثبت نام کرده اند
درصورت عدم همخوانی توضیحات با کتاب
از ساعت 7 صبح تا 10 شب
ویرایش:
نویسندگان: Miguel Angel Castiblanco Torres
سری:
ISBN (شابک) : 9781788626729, 1788626729
ناشر: Packt Publishing Ltd
سال نشر: 2018
تعداد صفحات: 266
زبان: English
فرمت فایل : EPUB (درصورت درخواست کاربر به PDF، EPUB یا AZW3 تبدیل می شود)
حجم فایل: 5 Mb
در صورت تبدیل فایل کتاب Learning Concurrency in Kotlin: Build highly efficient and robust applications به فرمت های PDF، EPUB، AZW3، MOBI و یا DJVU می توانید به پشتیبان اطلاع دهید تا فایل مورد نظر را تبدیل نمایند.
توجه داشته باشید کتاب همزمانی یادگیری در Kotlin: ساخت برنامه های کاربردی بسیار کارآمد و قوی نسخه زبان اصلی می باشد و کتاب ترجمه شده به فارسی نمی باشد. وبسایت اینترنشنال لایبرری ارائه دهنده کتاب های زبان اصلی می باشد و هیچ گونه کتاب ترجمه شده یا نوشته شده به فارسی را ارائه نمی دهد.
از مزیت های اولیه همزمانی کاتلین برای نوشتن برنامه های کاربردی چند رشته ای کارآمد استفاده کنید ویژگی های کلیدی روش منحصر به فرد کاتلین برای چند رشته ای را بیاموزید با مثال های عملی کار کنید که به شما کمک می کند تا کدهای غیر مسدود کننده همزمان بنویسید بهبود سرعت اجرای کلی در سیستم های چند پردازنده ای و چند هسته ای شرح کتاب الزامات اولیه مدرن مدرن برنامه های روزانه مقیاس پذیری، سرعت و استفاده حداکثری از سخت افزار هستند. Kotlin این الزامات را با پشتیبانی بیشمار خود برای همزمانی برآورده میکند. بسیاری از موارد اولیه همزمان کاتلین، مانند کانال ها و عملکردهای تعلیق، به گونه ای طراحی شده اند که مسدود کننده و کارآمد باشند. این اجازه می دهد تا برای رویکردهای جدید همزمانی و ایجاد چالش های منحصر به فرد برای طراحی و پیاده سازی کد همزمان. یادگیری همزمان در کاتلین با مثالها و تمرینهایی که از اصول اولیه کاتلین استفاده میکنند، به چالشها میپردازد. با مقدمهای بر روتینهای کاتلین، یاد میگیرید که چگونه کدهای همزمان بنویسید و مفاهیم اساسی مورد نیاز برای نوشتن نرمافزار چند رشتهای در کاتلین را درک کنید. شما نحوه برقراری ارتباط بین و همگام سازی موضوعات و برنامه های خود را برای نوشتن برنامه های ناهمزمان که مشارکتی هستند را بررسی خواهید کرد. همچنین یاد خواهید گرفت که چگونه خطاها و استثنائات را مدیریت کنید و همچنین نحوه استفاده از پردازش چند هسته ای را خواهید آموخت. علاوه بر این، شما به نحوه عملکرد داخلی کوروتین ها خواهید پرداخت و به شما امکان می دهد تصویر بزرگتر را ببینید. در طول کتاب شما یک برنامه اندروید – یک RSS reader – طراحی و پیاده سازی شده با توجه به موضوعات مختلف تحت پوشش در کتاب چه خواهید آموخت. تقاضا کاوش بهترین روشها برای مدیریت خطا از کانالها برای برقراری ارتباط بین برنامهها استفاده کنید کشف نحوه عملکرد کوروتینها در زیر سرپوش چه کسی است اگر یک توسعهدهنده کاتلین یا اندروید هستید که علاقهمند به یادگیری نحوه برنامهنویسی همزمان برای افزایش عملکرد برنامههایتان هستید، این کتاب برای شماست.
Take advantage of Kotlin's concurrency primitives to write efficient multithreaded applications Key Features Learn Kotlin’s unique approach to multithreading Work through practical examples that will help you write concurrent non-blocking code Improve the overall execution speed in multiprocessor and multicore systems Book Description The primary requirements of modern-day applications are scalability, speed, and making the most use of hardware. Kotlin meets these requirements with its immense support for concurrency. Many concurrent primitives of Kotlin, such as channels and suspending functions, are designed to be non-blocking and efficient. This allows for new approaches to concurrency and creates unique challenges for the design and implementation of concurrent code. Learning Concurrency in Kotlin addresses those challenges with real-life examples and exercises that take advantage of Kotlin's primitives. Beginning with an introduction to Kotlin's coroutines, you will learn how to write concurrent code and understand the fundamental concepts needed to be able to write multithreaded software in Kotlin. You'll explore how to communicate between and synchronize your threads and coroutines to write asynchronous applications that are collaborative. You'll also learn how to handle errors and exceptions, as well as how to leverage multi-core processing. In addition to this, you’ll delve into how coroutines work internally, allowing you to see the bigger picture. Throughout the book you'll build an Android application – an RSS reader – designed and implemented according to the different topics covered in the book What you will learn Understand Kotlin’s approach to concurrency Implement sequential and asynchronous suspending functions Create suspending data sources that are resumed on demand Explore the best practices for error handling Use channels to communicate between coroutines Uncover how coroutines work under the hood Who this book is for If you’re a Kotlin or Android developer interested in learning how to program concurrently to enhance the performance of your applications, this is the book for you.
Cover Title Page Copyright and Credits Packt Upsell Contributors Table of Contents Preface Chapter 1: Hello, Concurrent World! Processes, threads, and coroutines Processes Threads Coroutines Putting things together Introduction to concurrency Concurrency is not parallelism CPU-bound and I/O-bound CPU-bound I/O-bound Concurrency versus parallelism in CPU-bound algorithms Single-core execution Parallel execution Concurrency versus parallelism in I/O-bound algorithms Why concurrency is often feared Race conditions Atomicity violation Deadlocks Livelocks Concurrency in Kotlin Non-blocking Being explicit Readable Leveraged Flexible Concepts and terminology Suspending computations Suspending functions Suspending lambdas Coroutine dispatcher Coroutine builders Summary Chapter 2: Coroutines in Action Downloading and installing Android Studio Creating a Kotlin project Adding support for coroutines Android's UI thread CalledFromWrongThreadException NetworkOnMainThreadException Requesting in the background, updating in the UI thread Creating a thread CoroutineDispatcher Attaching a coroutine to a dispatcher Starting a coroutine with async Starting a coroutine with launch Using a specific dispatcher when starting the coroutine Adding networking permissions Creating a coroutine to call a service Adding UI elements What happens when the UI is blocked Displaying the amount of news that were processed Using a UI dispatcher Platform-specific UI libraries Adding the dependency Using Android's UI coroutine dispatcher Creating an asynchronous function to hold the request... or not A synchronous function wrapped in an asynchronous caller An asynchronous function with a predefined dispatcher An asynchronous function with a flexible dispatcher How to decide which option is better Summary Chapter 3: Life Cycle and Error Handling Job and Deferred Job Exception handling Life cycle New Active Canceling Cancelled Completed Determining the current state of a Job Deferred Exception handling States move in one direction only A note on final states RSS – Reading from multiple feeds concurrently Supporting a list of feeds Creating a thread pool Fetching the data concurrently Merging the responses Testing the concurrent requests Non-happy path – Unexpected crash Having deferred store the exception Don't ignore the exception! Summary Chapter 4: Suspending Functions and the Coroutine Context Improving the UI of the RSS Reader Giving each feed a name Fetching more information about the articles from the feed Adding a scrollable list for the articles Layout for the individual articles Adapter to map the information Adding a ViewHolder Mapping the data onCreateViewHolder onBindViewHolder getItemCount Allowing the incremental addition of articles to the adapter Connecting the adapter to the activity Testing the new UI Sanitizing the data Suspending functions Suspending functions in action Writing a repository with async functions Upgrading to suspending functions Suspending functions versus async functions The coroutine context Dispatcher CommonPool Default dispatcher Unconfined Single thread context Thread pool Exception handling Non-cancellable More about contexts Mixing contexts Combining contexts Separating contexts Temporary context switch using withContext Summary Chapter 5: Iterators, Sequences, and Producers Suspendable sequences and iterators Yielding values Iterators Interacting with an iterator Going through all the elements Getting the next value Validating whether there are more elements Calling next() without validating for elements A note on the inner working of hasNext() Sequences Interacting with a sequence Reading all the elements in the sequence Obtaining a specific element elementAt elementAtOrElse elementAtOrNull Obtaining a group of elements Sequences are stateless Suspending Fibonacci Writing a Fibonacci sequence Writing a Fibonnaci iterator Producers Creating a producer Interacting with a producer Reading all the elements in the producer Receiving a single element Taking a group of elements Taking more elements than those available Suspending a Fibonacci sequence using a producer Producers in action Having the adapter request more articles Creating a producer that fetches feeds on demand Adding the articles to the list on the UI Summary Chapter 6: Channels - Share Memory by Communicating Understanding channels Use case – streaming data Use case – distributing work Types of channels and backpressure Unbuffered channels RendezvousChannel Buffered channels LinkedListChannel ArrayChannel ConflatedChannel Interacting with channels SendChannel Validating before sending Sending elements Offering elements On channel closed On channel full On channel open and not full ReceiveChannel Validating before reading isClosedForReceive isEmpty Channels in action Adding a search activity Adding the search function Implementing the collaborative search Connecting the search functions Updating ArticleAdapter Displaying the results Summary Chapter 7: Thread Confinement, Actors, and Mutexes Atomicity violation What atomicity means Thread confinement What is thread confinement? Confining coroutines to a single thread Actors What is an actor? Creating an actor Using actors to extend the functionality More on actor interaction Buffered actors Actor with CoroutineContext CoroutineStart Mutual exclusions Understanding mutual exclusions Creating mutexes Interacting with mutual exclusions Volatile variables Thread cache @Volatile Why @Volatile doesn't solve thread-safe counters When to use @Volatile Atomic data structures Actors in action Adding the label to the UI Creating an actor to use as a counter Increasing the counter as results are loaded Adding a channel so that the UI reacts to updates Sending the updated value through the channel Updating the UI on changes Testing the implementation Extending the actor to allow for resetting the counter Resetting the counter upon new searches Summary Chapter 8: Testing and Debugging Concurrent Code Testing concurrent code Throwing away assumptions Focus on the forest, not the trees Writing Functional Tests More advice on tests Writing the tests Creating a flawed UserManager Adding the kotlin-test library Adding a happy path test Testing for an edge case Identifying the issue Fixing the crash Retesting Debugging Identifying a coroutine in the logs Using automatic naming Setting a specific name Identifying a coroutine in the debugger Adding a debugger watch Conditional breakpoint Resiliency and stability Summary Chapter 9: The Internals of Concurrency in Kotlin Continuation Passing Style Continuations The suspend modifier State machine Labels Continuations Callbacks Incrementing the label Storing the result from the other operations Returning the result of the suspending computation Context switching Thread switching ContinuationInterceptor CoroutineDispatcher CommonPool Unconfined Android's UI DispatchedContinuation DispatchedTask Recap Exception handling The handleCoroutineException() function CoroutineExceptionHandler CancellationException Cancelling the job Platform specific logic JVM JavaScript Summary Other Books You May Enjoy Index